giniedp / spritespin

jQuery plugin for spriteanimation.
http://giniedp.github.com/spritespin/
MIT License
378 stars 122 forks source link

There is an extra frame or something like that #89

Open newoldschool opened 1 year ago

newoldschool commented 1 year ago

Hello, have a new issue, probably is not a bug, maybe is just me that I cannot discover how to use all the features or plugins you offer.

You can see what I am doing here: https://wordpress-838489-2888976.cloudwaysapps.com/spritespin-test-1/

What I want is that when the cursor is in the right section of the animation, the person moves to that side, and if I move the cursor for example all the way to the left, the person follows that and moves to the left side.

Is a 180º animation right?

The problem I have is that there is an extra frame, or step. If I start moving from the left side to the right side, I see 5 changes, I am able to see 6 frames, the image change 5 times.

And if I immediately start moving again but this time from the right side to left side, now the image change 6 times!

So going to one side produce 5 image changes, and going to the other side produce 6 images changes. This break my animation, the animation should stop in both sides with the person with his arms raised.

How can I control this? I need both amount of image changes to be even. As you can see I'm trying to have a person rising his arms to the left when you are in the furthest left side, and then rising his arms to the right when you are in the furthest right side.

Thanks!

giniedp commented 1 year ago

i can't tell from the top of my head why there is that difference. But in that case i would go for a custom plugin, that shows a frame based on the mouse position instead of changing the frame based on mouse travel distance. https://stackblitz.com/edit/spritespin-example-kw7nra?file=index.html