and you can add easing function in the class. default will use ease_in_out_2
On Mar 16, 11:41 am, Philippe <[email protected]> wrote: > I did this small Class to solve my animation > needshttp://paste.pocoo.org/show/190229/ > maybe it helps. > > usage is really simple. > > def complete_tween(message=''): > print message > > @win.event > def on_mouse_press(x, y, button, modifiers): > Tween(my_sprite_1, 1., delay=0.5, vars={'x':200, 'y':300, > 'opacity':200, 'rotation':90}) > Tween(my_sprite_2, 1.5, on_complete=complete_tween, > on_complete_param={'message':'on wrapped_sprite'}, vars={'x':200}) > > you can tween any numeric property of any object. > you can add a callBack function when the tween reach its end. > > On Mar 15, 11:03 pm, Alejandro Castellanos > > <[email protected]> wrote: > > Hmmm. Sounds kind of similar to the way the timer example is set (from > > the pyglet docs). > > > It may take me a little while to get it working, but thank for > > answering. I'll see how to go around implementing it. > > > On 15 mar, 14:34, Casey Duncan <[email protected]> wrote: > > > > Maybe define an animation as a class with a start() method. This > > > method would do a schedule_interval() for the object's update() method > > > which would update the animation state. The start method would also do > > > a schedule_once() for the object's stop() method that would unschedule > > > update(). > > > > -Casey > > > > On Mon, Mar 15, 2010 at 1:52 PM, Alejandro Castellanos > > > > <[email protected]> wrote: > > > > Hello, I was trying to find my way around pyglet's particular use of > > > > functions, but I can only choose from either thriggering their use > > > > once after a determinate set of time, and triggering them in an > > > > indefinite interval. > > > > > My problem is that I'm trying to find a way to make animations (or an > > > > action, basically) that last a set amount of time, and then stops > > > > executing. Think of it as an instruction that tells an image to > > > > smoothly move to the right for 100 pixels, showing each step of the > > > > movement on screen, and then stop. Instead I can only make it move the > > > > whole distance at one (or I could control it manually using the > > > > keyboard, but that's not what I'm after). > > > > > I'm using these: > > > > --- > > > > > pyglet.clock.schedule_interval(function, interval) > > > > > pyglet.clock.schedule_once(function, start time) > > > > > --- > > > > > I think the way around it may be by using the clock, but so far I'm > > > > out of luck. Any suggestions? > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "pyglet-users" group. > > > > To post to this group, send email to [email protected]. > > > > To unsubscribe from this group, send email to > > > > [email protected]. > > > > For more options, visit this group > > > > athttp://groups.google.com/group/pyglet-users?hl=en. -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
