Open in CoCalc
t = var('t') v = [cos(c*pi*t) for c in sxrange(1,2,.2)] animate(v)
def f(x): P1= polygon([(x+3,3.8), (x+3,3), (x+1,3), (x+1,3.8)]) P2= polygon([(x+3.5,3.4),(x+3.5,3), (x+0.5,3), (x+0.5,3.4)]) P3= circle((x+1,3), 0.2, rgbcolor='yellow', fill=True) P4= circle((x+3,3), 0.2, rgbcolor='yellow', fill=True) P5= circle((x+1,3), 0.1, rgbcolor='orange', fill=True) P6= circle((x+3,3), 0.1, rgbcolor='orange', fill=True, xmin=0, xmax=6) return P1+P2+P3+P4+P5+P6 v = [f(x) for x in [0,0.3,..,2]] a = animate(v)
a
a.save('car.gif') smc.file('car.gif')