Created
August 2, 2013 13:14
-
-
Save idflood/6139788 to your computer and use it in GitHub Desktop.
Little Adobe Edge Animate wrapper for superscrollorama.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(global) { | |
function EdgeWrapper (compId) { | |
this.compId = compId; | |
this.composition = AdobeEdge.getComposition(compId); | |
this.stage = this.composition.getStage(); | |
}; | |
EdgeWrapper.prototype.play = function() { | |
this.stage.play(); | |
return this; | |
}; | |
EdgeWrapper.prototype.pause = function() { | |
this.stage.stop(); | |
return this; | |
}; | |
EdgeWrapper.prototype.progress = function(progress) { | |
var time = progress * this.stage.getDuration(); | |
this.stage.stop(time); | |
return this; | |
}; | |
var tickCallback = false; | |
var update = function() { | |
if (tickCallback) { | |
tickCallback(); | |
} | |
requestAnimationFrame(update); | |
}; | |
if (!global.TweenLite) { | |
global.TweenLite = { | |
ticker: { | |
addEventListener: function(name, tickHandler) { | |
tickCallback = tickHandler; | |
update(); | |
} | |
} | |
}; | |
} | |
global.EdgeWrapper = EdgeWrapper; | |
})(window); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var controller = $.superscrollorama(); | |
var compo1 = new EdgeWrapper("step1"); // Pass the name of the animate composition. | |
controller.pin(".compo-wrapper", 400, { | |
anim: compo1, | |
offset: 0 | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi - This looks to be what I have been looking for. I want to add this to my edge animate project. Can you please explain how this code works. Do I paste this all inside edge animate?