from tween import Tween
Tween(sneik, 1., vars={'x':sneik.x+70})
to move sneik to sneik.x+70 in 1 second
On Mar 17, 4:04 pm, Alejandro Castellanos
<[email protected]> wrote:
> Hello. I'm just writing to report that I just kind of found a way
> around it. It's not as sophisticated as Casey's suggestion or
> Philippe's tween class (which went a bit over my head, I should add,
> sorry), and it's nowhere near as neat as Rabbyt's anims, but it
> works... ...in a naive sockpuppet kind of way.
>
> ----------------------------------------
>
> aa=sneik.x #sneik is my sprite...
>
> def monomove(dt): #My function that moves my sprite...
> sprite=sneik
> if sprite.x >= aa+70:
> print "Yay."
> clock.unschedule(monomove)
>
> sprite.x=sprite.x+r #r is a constant.
>
> pyglet.clock.schedule_interval(monomove, 1.0/60.0)
>
> ----------------------------------------
>
> So, that's my sockpuppet and so far it works just enough. I'll try to
> get it working more neatly as that was my trial run but I don't
> predict it becoming overtly complex (I'll probably turn it into a
> class but who knows). Blame it on my physics background, we try to
> find our way around with the simplest of things.
>
> I'd really like to thank everyone that posted suggestions. You really
> helped me out here.
>
> Be seing you around and, again, thanks.
>
> On 16 mar, 08:06, Mikael Lind <[email protected]> wrote:
>
> > Rabbyt has similar functionality.
>
> >http://matthewmarshall.org/projects/rabbyt/
>
> > On 16 March 2010 15:35, Alejandro Castellanos
>
> > <[email protected]> wrote:
> > > Seems extremely interesting. I'll give it a go.
>
> > > Thanks, a bunch.
>
> > > On 16 mar, 03:43, Philippe <[email protected]> wrote:
> > >> 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
> > > athttp://groups.google.com/group/pyglet-users?hl=en.
>
> > --
> > Mikael Lindhttp://elemel.se/
--
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.