3804 posts
  • Elite Author
  • Author Level 11
  • Trendsetter
  • 7 Years of Membership
+12 more
KrownThemes
says

Does anyone have experience with requestAnimationFrame?

Scenario:

1. I have a bunch of canvas items
2. When i “mouse over” an item, it modifies it’s shape(redraws the canvas up to a certain point, when the animation is cancelled)
3. When i “mouse out” an item, the shape modifies again(redraws the canvas from the point where the animation was left, until it hits the beginning value)

Bug:

When i put my mouse over an other item, the requestAnimationFrame cancels my first animation and continues with the second one. So my first item has a bad shape(it stops the animation where it was when i hovered the second item). And this goes on for all my items.

Solution:

I think that this is because the requestAnimationFrame is working on the window object. Does anyone has any experience in putting the function on an object, so that you can have multiple requestAnimationFrame instances running on the screen at the same time?

62 posts creative.performance
  • United Kingdom
  • 5 Years of Membership
  • Elite Author
  • Trendsetter
+8 more
mediacreed
says

Does anyone have experience with requestAnimationFrame?

Scenario:

1. I have a bunch of canvas items
2. When i “mouse over” an item, it modifies it’s shape(redraws the canvas up to a certain point, when the animation is cancelled)
3. When i “mouse out” an item, the shape modifies again(redraws the canvas from the point where the animation was left, until it hits the beginning value)

Bug:

When i put my mouse over an other item, the requestAnimationFrame cancels my first animation and continues with the second one. So my first item has a bad shape(it stops the animation where it was when i hovered the second item). And this goes on for all my items.

Solution:

I think that this is because the requestAnimationFrame is working on the window object. Does anyone has any experience in putting the function on an object, so that you can have multiple requestAnimationFrame instances running on the screen at the same time?

I don’t have any experience with requestAnimationFrame on canvas. I do have an experience with animations and i could help you with hints. Also i like fixing tough bugs or finding solutions to temporary issues.

Send me a private message and I will try and help you!

Cheers,
Mediacreed

5467 posts The Dude Abides
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
  • United States
+13 more
CodingJack
says

This shouldn’t be the case:

http://jsfiddle.net/hZUD3/1/
3804 posts
  • Elite Author
  • Author Level 11
  • Trendsetter
  • 7 Years of Membership
+12 more
KrownThemes
says

This shouldn’t be the case: http://jsfiddle.net/hZUD3/1/

Thanks a lot! Both for this and for the private help! :)

by
by
by
by
by
by