Skip to content

Instantly share code, notes, and snippets.

@idflood
Created August 2, 2013 13:14
Show Gist options
  • Save idflood/6139788 to your computer and use it in GitHub Desktop.
Save idflood/6139788 to your computer and use it in GitHub Desktop.
Little Adobe Edge Animate wrapper for superscrollorama.
(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);
var controller = $.superscrollorama();
var compo1 = new EdgeWrapper("step1"); // Pass the name of the animate composition.
controller.pin(".compo-wrapper", 400, {
anim: compo1,
offset: 0
});
@electrolegs
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment