Open Bug 608207 Opened 15 years ago Updated 3 years ago

requestAnimationFrame for mousemove related animations

Categories

(Core :: Layout, enhancement)

x86
Windows 7
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: giorgio.liscio, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b8pre) Gecko/20101028 Firefox/4.0b8pre Build Identifier: hi, is possible to extend the functionality of requestAnimationFrame to the mousemove related animations? maybe it is possible to do it now, but i'm doing it wrong, because i can't see good performances thank you Reproducible: Always
I'm not sure what you're asking for here. requestAnimationFrame can be called from anywhere you want, including mousemove handlers. What's the problem you're having?
Assignee: general → nobody
Component: JavaScript Engine → Layout
QA Contact: general → layout
hi boris, how are you? for to have benefit of mozrequestanimationframe i should put the animation code in mozbeforepaint event? now i have addEventListener("mousemove", function mmHandler(ev){ // anim here window.mozRequestAnimationFrame(); },true);
The point of mozRequestAnimationFrame is to ask to be notified before the browser is about to paint. So if your code is structured as in comment 2, then yes the call is pointless. You'd want to put your "anim here" code in the mozbeforepaint event handler.
so... something like this can be good? addEventListener("mousemove", function(mmevent) { addEventListener("mozbeforepaint", function(ev){ // animation here removeEventListener("mozbeforepaint",arguments.callee,true); },true); window.mozRequestAnimationFrame(); },true);
Yes, depending on what "animation here" does. Or you could just skip the mozbeforepaint event and pass your function directly to mozRequestAnimationFrame, if you just want it to run once.
the animation positions a box according to mouse coordinates (mmevent) i'm testing it, thank you for now
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.