mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-08-18 16:48:20 +02:00
AWESSOMEEE now converted animation queue to promise based too
This commit is contained in:
parent
4619eb370c
commit
c8d117073f
4 changed files with 66 additions and 21 deletions
|
@ -58,13 +58,18 @@ AnimationFactory.prototype.genCommitBirthAnimation = function(animationQueue, co
|
|||
AnimationFactory.prototype.genCommitBirthPromiseAnimation = function(commit, gitVisuals) {
|
||||
var visNode = commit.get('visNode');
|
||||
var anPack = makeCommitBirthAnimation(gitVisuals, visNode);
|
||||
console.log('my duration', anPack.duration);
|
||||
return new PromiseAnimation({
|
||||
closure: anPack.animation,
|
||||
duration: anPack.duration
|
||||
});
|
||||
};
|
||||
|
||||
AnimationFactory.prototype.playCommitBirthPromiseAnimation = function(commit, gitVisuals) {
|
||||
var animation = this.genCommitBirthPromiseAnimation(commit, gitVisuals);
|
||||
animation.play();
|
||||
return animation.getPromise();
|
||||
};
|
||||
|
||||
AnimationFactory.prototype.overrideOpacityDepth2 = function(attr, opacity) {
|
||||
opacity = (opacity === undefined) ? 1 : opacity;
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ var AnimationQueue = Backbone.Model.extend({
|
|||
animations: null,
|
||||
index: 0,
|
||||
callback: null,
|
||||
defer: false
|
||||
defer: false,
|
||||
promiseBased: false,
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
|
@ -39,6 +40,13 @@ var AnimationQueue = Backbone.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
thenFinish: function(promise) {
|
||||
promise.then(_.bind(function() {
|
||||
this.finish();
|
||||
}, this));
|
||||
this.set('promiseBased', true);
|
||||
},
|
||||
|
||||
add: function(animation) {
|
||||
if (!animation instanceof Animation) {
|
||||
throw new Error("Need animation not something else");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue