# Drawing software with slight animation capabilities

I am looking for a drawing software which has animation capabilities. That being said, it shouldn't be completely animation oriented. I only need it for the purpose of teaching physics, that is draw a moving pendulum etc. I saw a video of KhanAcademy using a software meeting my requirements, but unfortunately, I couldn't tell which software it is. This is the video:https://m.youtube.com/watch?v=_4VC3IHbuW8 (at 9:27). So in short, I need software recommendations meeting the above criteria or just the name of the software used in the video.

I would strongly suggest investing some time, (but absolutely no money), in looking into Python, Jupyter and the associated tools such as matplotlib.

One of the great thing is that with these tools rather than drawing what your experience tells you happens in physics systems and animating it you can simulate the physical system with an animation as the display and then your, or your students, can play with the parameters to see how they vary the behavior.

Another is that they are completely free, gratis & open source, and will run on most platforms from a RaspberryPi, up through OS-X & Windows, on through workstations to super computing clusters - so your students can run them at home.

In python this matplotlib example the following code produces an animation of a double pendulum, (source code from the matplotlib examples):

``````"""
===========================
The double pendulum problem
===========================

This animation illustrates the double pendulum problem.
"""

# Double pendulum formula translated from the C code at
# http://www.physics.usyd.edu.au/~wheat/dpend_html/solve_dpend.c

from numpy import sin, cos
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate as integrate
import matplotlib.animation as animation

G = 9.8  # acceleration due to gravity, in m/s^2
L1 = 1.0  # length of pendulum 1 in m
L2 = 1.0  # length of pendulum 2 in m
M1 = 1.0  # mass of pendulum 1 in kg
M2 = 1.0  # mass of pendulum 2 in kg

def derivs(state, t):

dydx = np.zeros_like(state)
dydx = state

del_ = state - state
den1 = (M1 + M2)*L1 - M2*L1*cos(del_)*cos(del_)
dydx = (M2*L1*state*state*sin(del_)*cos(del_) +
M2*G*sin(state)*cos(del_) +
M2*L2*state*state*sin(del_) -
(M1 + M2)*G*sin(state))/den1

dydx = state

den2 = (L2/L1)*den1
dydx = (-M2*L2*state*state*sin(del_)*cos(del_) +
(M1 + M2)*G*sin(state)*cos(del_) -
(M1 + M2)*L1*state*state*sin(del_) -
(M1 + M2)*G*sin(state))/den2

return dydx

# create a time array from 0..100 sampled at 0.05 second steps
dt = 0.05
t = np.arange(0.0, 20, dt)

# th1 and th2 are the initial angles (degrees)
# w10 and w20 are the initial angular velocities (degrees per second)
th1 = 120.0
w1 = 0.0
th2 = -10.0
w2 = 0.0

# initial state
state = np.radians([th1, w1, th2, w2])

# integrate your ODE using scipy.integrate.
y = integrate.odeint(derivs, state, t)

x1 = L1*sin(y[:, 0])
y1 = -L1*cos(y[:, 0])

x2 = L2*sin(y[:, 2]) + x1
y2 = -L2*cos(y[:, 2]) + y1

fig = plt.figure()
ax = fig.add_subplot(111, autoscale_on=False, xlim=(-2, 2), ylim=(-2, 2))
ax.grid()

line, = ax.plot([], [], 'o-', lw=2)
time_template = 'time = %.1fs'
time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes)

def init():
line.set_data([], [])
time_text.set_text('')
return line, time_text

def animate(i):
thisx = [0, x1[i], x2[i]]
thisy = [0, y1[i], y2[i]]

line.set_data(thisx, thisy)
time_text.set_text(time_template % (i*dt))
return line, time_text

ani = animation.FuncAnimation(fig, animate, np.arange(1, len(y)),
interval=25, blit=True, init_func=init)
# Uncomment the next line to save to a movie file
# ani.save('double_pendulum.mp4', fps=15)
plt.show()
``````

This results in, saved as gif with resolution and frame rate reduced for SO limits: You may also find this gallery of notebooks interesting & useful and there are a huge number of other examples available online.

• Thanks. This is helpful indeed, but I'm actually looking for something simpler as I am to suggest this software to someone less used to computers. – Utkarsh Verma Aug 9 '18 at 14:53
• Personally I think vPython (vpython.org) is even better for this. – Eric Shain Aug 9 '18 at 22:49