3802 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Had an item that was trending
  • Has been part of the Envato Community for over 7 years
+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?

61 posts creative.performance
  • Located in United Kingdom
  • Has been part of the Envato Community for over 5 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Had an item that was trending
+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

5465 posts The Dude Abides
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Located in United States
+13 more
CodingJack
says

This shouldn’t be the case:

http://jsfiddle.net/hZUD3/1/
3802 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Had an item that was trending
  • Has been part of the Envato Community for over 7 years
+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