Script demo_animator_py
[hide private]
[frames] | no frames]

Source Code for Script script-demo_animator_py

 1  """ 
 2  FILE: demo-animator.py 
 3   
 4   
 5  """ 
 6  from joy import JoyApp 
 7  from joy.plans import AnimatorPlan 
 8  from joy.decl import KEYDOWN   
 9  from numpy import linspace, sin 
10   
11 -def animationGen(fig):
12 th = linspace(0,6.28*4,200) 13 while True: 14 for k in th: 15 fig.clf() 16 ax = fig.gca() 17 ax.plot( th, sin(th+k), 'b-') 18 ax.plot( th[::4], sin((th[::4]+k)*2), 'r.-' ) 19 yield
20
21 -class App(JoyApp):
22 - def onStart(self):
24
25 - def onEvent(self,evt):
26 if evt.type == KEYDOWN: 27 return JoyApp.onEvent(self,evt)
28 29 if __name__=="__main__": 30 app = App() 31 app.run() 32