3428 posts Ruben Bristian
  • Most Wanted Bounty Winner
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Won a Competition
  • Bought between 100 and 499 items
  • Exclusive Author
  • Referred between 500 and 999 users
+5 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
  • Elite Author
  • United Kingdom
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Referred between 50 and 99 users
  • Bought between 10 and 49 items
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

5310 posts The Dude Abides
  • United States
  • Exclusive Author
  • Has been a member for 5-6 years
  • Elite Author
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Author had a Free File of the Month
+5 more
CodingJack says

This shouldn’t be the case:

http://jsfiddle.net/hZUD3/1/
3428 posts Ruben Bristian
  • Most Wanted Bounty Winner
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Won a Competition
  • Bought between 100 and 499 items
  • Exclusive Author
  • Referred between 500 and 999 users
+5 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