3524 posts Ruben Bristian
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
+10 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?

49 posts creative.performance
  • Has referred 50+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+5 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

5325 posts The Dude Abides
  • Located in United States
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
+9 more
CodingJack says

This shouldn’t be the case:

http://jsfiddle.net/hZUD3/1/
3524 posts Ruben Bristian
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
+10 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