Skip to content

Instantly share code, notes, and snippets.

@madrobby madrobby/gist:34305
Created Dec 10, 2008

Embed
What would you like to do?
var s2 = {
Version: '2.0.0a1'
};
s2.fx = new (function(){
var queues = [], globalQueue, heartbeat, activeEffectCount = 0;
this.beatOnDemand = function(dir){
heartbeat[(activeEffectCount += dir) > 0 ? 'start' : 'stop']();
};
this.renderQueues = function(){
queues.invoke('render', heartbeat.getTimestamp());
};
this.getQueues = function(){
return queues;
};
this.addQueue = function(queue){
queues.push(queue);
};
queues.push(globalQueue = new Scripty2.Effect.Queue());
heartbeat = new Scripty2.Effect.Heartbeat();
document
.observe('effect:heartbeat', this.renderQueues)
.observe('effect:queued', this.beatOnDemand.curry(1))
.observe('effect:dequeued', this.beatOnDemand.curry(-1));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.