Add a way to pause the background animation #220

I currently set href to "" because I don't currently know how to interface with session variables directly through html tags. "Basic View" and "Standard View" have different lengths, so the footer shifts when the button is pressed. The paused background state is different from the paused state when the user once again switches to the tab after a period of time, where the triangles are all orange and regular. The session variable can also be renamed and used elsewhere to perhaps make the page less reactive, for example in displaying search results, to reduce lag.
@_background.render returns:
<canvas width="2560" height="838" style="background-color: rgb(255, 255, 255); width: 1280px; height: 419px;"></canvas>

pixi.js: 

if (!window.requestAnimationFrame)
    window.requestAnimationFrame = function(callback, element) {
        var currTime = new Date().getTime();
        var timeToCall = Math.max(0, 16 - (currTime - lastTime));
        var id = window.setTimeout(function() { callback(currTime + timeToCall); },
          timeToCall);
        lastTime = currTime + timeToCall;
        return id;
    };

if (!window.cancelAnimationFrame)
    window.cancelAnimationFrame = function(id) {
        clearTimeout(id);
    };

window.requestAnimFrame = window.requestAnimationFrame;


Currently the present time is used to decide how to modify the background, and the function is called again after timeToCall time. The code above is in pixi.js and is linked to variable frame in background.coffee, so I’m confused how I solve the issue by passing in an object property set to the time of pause without modifying pixi.js. Do you mean a slight modification to the code in pixi.js in which new Date().getTime() is replaced with an object?

On Jul 2, 2014, at 3:07 AM, Mitar <notifications@github.com> wrote:

> In client/lib/background.coffee:
> 
> > @@ -34,6 +34,7 @@ class Vector
> >      @deltaY = 0
> >  
> >    update: (time) =>
> > +    return if Session.get 'backgroundPaused'
> I think what is being appended is a nonreactive execution of background.render on all landing page(s)
> 
> How could "nonreactive execution" be appended? I am not sure what data object it would be.
> 
> You know, you can try things out. Assign return value of background.render() to a variable, print it out using console.log, and then pass it to append and you will see what it is.
> 
> Make a hypothesis (any is valid) and then make an experiment which would show if it is false. For example, if it is a "nonreactive execution of background" then it will probably have to be something strange. Check it and see what it is.
> 
> Or I shouldn’t modify pixi.js because it’s licensed from MIT?
> 
> You can modify pixi.js as much as you want (MIT license definitively allows that), but I do not believe you need to do that? Why would you have to? Are you again mixing @renderer.render and Background.render?
> 
> If I have the background resume animation at the same time I may have to add another time variable to pass into frame.
> 
> Or you could have an object property which you set to the time of pause.
> 
> —
> Reply to this email directly or view it on GitHub.
>