Re: [css-display]? Compositing, expensive things, and laziness

> Again, read earlier in the thread.  This exact question was raised by
> roc, and Ali answered him. I'm not as well qualified to answer this.

I don't think our proposal have much in common, except the fact both use 
rAF. Roc's proposal was about using the normal rAF to trigger the animation 
in a delayed fashion (which does not work because you just delayed the 
problem). That's not what I'm proposing.

Maybe I didn't express my idea well, but I propose to use

    (1) the "display-optionality: optional" declaration to indicate the 
rendering of the element is facultative.
    (2) an element-tied rAF which only fires when an element has been 
painted and is ready for his next frame.

So, let's imagine we have our javascript that decide the video is preloaded 
:

    {
        theVideo.classList.add("start-rendering");
        theVideo.requestAnimationFrame(function() {
            // theVideo has been drawn during previous frame:
            // we're ready to start fading in
            theVideo.classList.add("start-fading-in");
        });
    }

In the case the "start-rendering" operation succeed at the first frame, the 
video starts fading in immediately; otherwhise a few "global AF" may elapse 
before our first theVideo's AF is called.



Another way to express it, this time with pseudo-code:

    theVideo.requestAnimation(callback) :=
        window.requestAnimationFrame(=> {
            if(theVideo._wasNotRenderedInPreviousFrame) { 
window.requestAnimationFrame(arguments.callee); }
            else { callback(); }
        }) 

Received on Friday, 21 June 2013 19:20:14 UTC