platipy / spyral

http://platipy.org
Other
49 stars 12 forks source link

Animating from "<sprite>.<attribute>.animation.end" event handler behaves strangely. #56

Open icarito opened 10 years ago

icarito commented 10 years ago

Expected result: constant animation from side to side Actual result: For every animation cycle, speed seems to increase (but self.vel remains the same!)

class Ciudadano(spyral.Sprite):
    def __init__(self, scene):
        spyral.Sprite.__init__(self, scene)
        self.image = spyral.Image("images/man.png")
        self.vel = 100 
        self.x, self.y = 100, 100
        spyral.event.register("Ciudadano.x.animation.end", self.avanzar, scene=self.scene)

    def avanzar(self):
        if self.x > self.scene.width or self.x < 0:
            self.vel = self.vel * -1

        orig = self.x
        dest = orig + self.vel
        self.anim = spyral.Animation("x", spyral.easing.Linear(orig,dest), duration=10)

        self.animate(self.anim)
acbart commented 10 years ago

Sorry I haven't had a chance to take a look at this; it's been a crazy week at school! I'm not sure why it'd be doing that, I'll have to try it out and see!

icarito commented 10 years ago

I encounterered the same issue by trying to make a constantly animated background. If I animate a sprite using the "<sprite>.<attribute>.animation.end" event, what I get is an animation which is much faster than the previous one.

icarito commented 9 years ago

Here, hi, this bit me again: https://github.com/icarito/ug1 Is spyral mantained? If not we should look into what it would take, I can offer some help.

acbart commented 9 years ago

Is Spyral maintained?

Good question! The answer is mostly! @rdeaton is on vacation for a few months as he changes jobs, and I'm recovering from my semester and finishing up a lot of ongoing PhD work. I believe that Spyral is being used this Spring in a university class (but haven't gotten confirmation yet), so it will be given some attention again. That said, I know I have a lot more duties than I did this time last year and I have to prioritize the research for my advisers. I'll still try to commit as much time as I can to this.

So, if you are at all interested in giving us pull requests and working with spyral itself, I would be exceptionally happy to help and answer questions. We've had some students at a friendly university working on some new GUI widgets, and I think we'll be getting a pull request from them sometime soon. So we've had a little bit of experience getting other people into our codebase.

icarito commented 9 years ago

Thanks for your sincere answer. I will try to contribute back as much as I can. We can coordinate on issues right here. Would be nice to close the ones that are not really actionable, or already solved. For others I'll try to provide pull requests.

acbart commented 9 years ago

Good thought - let me spend a few minutes going through old issues!