BOOM commit birthing animation done and animation factory fleshed out

This commit is contained in:
Peter Cottle 2012-09-29 19:08:13 -07:00
parent bc4b9246eb
commit 23ee6944e2
6 changed files with 106 additions and 20 deletions

View file

@ -1,13 +1,41 @@
/******************
* This class is responsible for a lot of the heavy lifting around creating an animation at a certain state in time.
* The tricky thing is that when a new commit has to be "born," say in the middle of a rebase or something, it must animate
* out from the parent position to it's birth position.
* The tricky thing is that when a new commit has to be "born," say in the middle of a rebase
* or something, it must animate out from the parent position to it's birth position.
* These two positions though may not be where the commit finally ends up. So we actually need to take a snapshot of the tree,
* store all those positions, take a snapshot of the tree after a layout refresh afterwards, and then animate between those two spots.
* and then essentially animate the entire tree too.
* not sure if this is necessary yet, so ill hold off for now. lets do some refs
*/
// essentially a static class
function AnimationFactory() {
}
AnimationFactory.prototype.genCommitBirthAnimation = function(animationQueue, commit) {
if (!animationQueue) {
throw new Error("Need animation queue to add closure to!");
}
var time = GRAPHICS.defaultAnimationTime * 1.0;
// essentially refresh the entire tree, but do a special thing for the commit
var visNode = commit.get('visNode');
var animation = function() {
// this takes care of refs and all that jazz, and updates all the positions
gitVisuals.refreshTree(time);
visNode.setBirthPosition();
visNode.setOutgoingEdgesBirthPosition();
visNode.parentInFront();
visNode.animateUpdatedPosition(time);
visNode.animateOutgoingEdges(time);
};
animationQueue.add(new Animation({
closure: animation
}));
};