mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 07:58:34 +02:00
damn. really nice finish animation now, albeit a bit of a tangent
This commit is contained in:
parent
ebaae41a38
commit
029456e3d8
5 changed files with 208 additions and 46 deletions
168
build/bundle.js
168
build/bundle.js
|
@ -9562,37 +9562,90 @@ GitVisuals.prototype.finishAnimation = function() {
|
||||||
var defaultTime = GRAPHICS.defaultAnimationTime;
|
var defaultTime = GRAPHICS.defaultAnimationTime;
|
||||||
var nodeRadius = GRAPHICS.nodeRadius;
|
var nodeRadius = GRAPHICS.nodeRadius;
|
||||||
|
|
||||||
deferred.promise.then(_.bind(function() {
|
var textString = 'Solved!!\n:D';
|
||||||
|
var text = null;
|
||||||
|
var makeText = _.bind(function() {
|
||||||
|
text = this.paper.text(
|
||||||
|
this.paper.width / 2,
|
||||||
|
this.paper.height / 2,
|
||||||
|
textString
|
||||||
|
);
|
||||||
|
text.attr({
|
||||||
|
opacity: 0,
|
||||||
|
'font-weight': 500,
|
||||||
|
'font-size': '32pt',
|
||||||
|
'font-family': 'Monaco, Courier, font-monospace',
|
||||||
|
stroke: '#000',
|
||||||
|
'stroke-width': 2,
|
||||||
|
fill: '#000'
|
||||||
|
});
|
||||||
|
text.animate({ opacity: 1 }, defaultTime);
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
// this is a BIG ANIMATION but it ends up just being
|
||||||
|
// a sweet chain of promises but is pretty nice. this is
|
||||||
|
// after I discovered promises / deferred's. Unfortunately
|
||||||
|
// I wrote a lot of the git stuff before promises, so
|
||||||
|
// that's somewhat ugly
|
||||||
|
|
||||||
|
deferred.promise
|
||||||
|
// first fade out everything but circles
|
||||||
|
.then(_.bind(function() {
|
||||||
return this.animateAllAttrKeys(
|
return this.animateAllAttrKeys(
|
||||||
{ exclude: ['circle'] },
|
{ exclude: ['circle'] },
|
||||||
{ opacity: 0 },
|
{ opacity: 0 },
|
||||||
defaultTime * 1.5
|
defaultTime * 1.1
|
||||||
);
|
);
|
||||||
|
|
||||||
}, this))
|
}, this))
|
||||||
|
// then make circle radii bigger
|
||||||
.then(_.bind(function() {
|
.then(_.bind(function() {
|
||||||
return this.animateAllAttrKeys(
|
return this.animateAllAttrKeys(
|
||||||
{
|
{ exclude: ['arrow', 'rect', 'path', 'text'] },
|
||||||
include: ['circle'],
|
|
||||||
exclude: ['arrow', 'rect', 'path', 'text']
|
|
||||||
},
|
|
||||||
{ r: nodeRadius * 2 },
|
{ r: nodeRadius * 2 },
|
||||||
defaultTime * 2
|
defaultTime * 1.5
|
||||||
);
|
);
|
||||||
|
}, this))
|
||||||
|
// then shrink em super fast
|
||||||
|
.then(_.bind(function() {
|
||||||
|
return this.animateAllAttrKeys(
|
||||||
|
{ exclude: ['arrow', 'rect', 'path', 'text'] },
|
||||||
|
{ r: nodeRadius * 0.75 },
|
||||||
|
defaultTime * 0.5
|
||||||
|
);
|
||||||
|
}, this))
|
||||||
|
// then explode them and display text
|
||||||
|
.then(_.bind(function() {
|
||||||
|
makeText();
|
||||||
|
return this.explodeNodes();
|
||||||
}, this))
|
}, this))
|
||||||
.then(_.bind(function() {
|
.then(_.bind(function() {
|
||||||
return this.explodeNodes();
|
return this.explodeNodes();
|
||||||
|
}, this))
|
||||||
|
// then fade circles (aka everything) in and back
|
||||||
|
.then(_.bind(function() {
|
||||||
|
return this.animateAllAttrKeys(
|
||||||
|
{ exclude: ['arrow', 'rect', 'path', 'text'] },
|
||||||
|
{},
|
||||||
|
defaultTime * 1.25
|
||||||
|
);
|
||||||
|
}, this))
|
||||||
|
// then fade everything in and remove text
|
||||||
|
.then(_.bind(function() {
|
||||||
|
text.animate({ opacity: 0 }, defaultTime, undefined, undefined, function() {
|
||||||
|
text.remove();
|
||||||
|
});
|
||||||
|
return this.animateAllAttrKeys(
|
||||||
|
{},
|
||||||
|
{}
|
||||||
|
);
|
||||||
}, this))
|
}, this))
|
||||||
.fail(function(reason) {
|
.fail(function(reason) {
|
||||||
console.warn('Finish animation failed due to ', reason);
|
console.warn('Finish animation failed due to ', reason);
|
||||||
throw reason;
|
throw reason;
|
||||||
})
|
});
|
||||||
.done();
|
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve(); // start right away
|
||||||
return deferred;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.explodeNodes = function() {
|
GitVisuals.prototype.explodeNodes = function() {
|
||||||
|
@ -10522,7 +10575,7 @@ var VisNode = VisBase.extend({
|
||||||
cy: y
|
cy: y
|
||||||
});
|
});
|
||||||
// continuation calculation
|
// continuation calculation
|
||||||
return (vx * vx + vy * vy > 0.01) ? true : false;
|
return ((vx * vx + vy * vy) > 0.01) ? true : false;
|
||||||
};
|
};
|
||||||
return stepFunc;
|
return stepFunc;
|
||||||
},
|
},
|
||||||
|
@ -10603,6 +10656,7 @@ var VisBase = Backbone.Model.extend({
|
||||||
|
|
||||||
exports.VisBase = VisBase;
|
exports.VisBase = VisBase;
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
require.define("/src/js/visuals/visBranch.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
require.define("/src/js/visuals/visBranch.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||||
|
@ -14894,37 +14948,90 @@ GitVisuals.prototype.finishAnimation = function() {
|
||||||
var defaultTime = GRAPHICS.defaultAnimationTime;
|
var defaultTime = GRAPHICS.defaultAnimationTime;
|
||||||
var nodeRadius = GRAPHICS.nodeRadius;
|
var nodeRadius = GRAPHICS.nodeRadius;
|
||||||
|
|
||||||
deferred.promise.then(_.bind(function() {
|
var textString = 'Solved!!\n:D';
|
||||||
|
var text = null;
|
||||||
|
var makeText = _.bind(function() {
|
||||||
|
text = this.paper.text(
|
||||||
|
this.paper.width / 2,
|
||||||
|
this.paper.height / 2,
|
||||||
|
textString
|
||||||
|
);
|
||||||
|
text.attr({
|
||||||
|
opacity: 0,
|
||||||
|
'font-weight': 500,
|
||||||
|
'font-size': '32pt',
|
||||||
|
'font-family': 'Monaco, Courier, font-monospace',
|
||||||
|
stroke: '#000',
|
||||||
|
'stroke-width': 2,
|
||||||
|
fill: '#000'
|
||||||
|
});
|
||||||
|
text.animate({ opacity: 1 }, defaultTime);
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
// this is a BIG ANIMATION but it ends up just being
|
||||||
|
// a sweet chain of promises but is pretty nice. this is
|
||||||
|
// after I discovered promises / deferred's. Unfortunately
|
||||||
|
// I wrote a lot of the git stuff before promises, so
|
||||||
|
// that's somewhat ugly
|
||||||
|
|
||||||
|
deferred.promise
|
||||||
|
// first fade out everything but circles
|
||||||
|
.then(_.bind(function() {
|
||||||
return this.animateAllAttrKeys(
|
return this.animateAllAttrKeys(
|
||||||
{ exclude: ['circle'] },
|
{ exclude: ['circle'] },
|
||||||
{ opacity: 0 },
|
{ opacity: 0 },
|
||||||
defaultTime * 1.5
|
defaultTime * 1.1
|
||||||
);
|
);
|
||||||
|
|
||||||
}, this))
|
}, this))
|
||||||
|
// then make circle radii bigger
|
||||||
.then(_.bind(function() {
|
.then(_.bind(function() {
|
||||||
return this.animateAllAttrKeys(
|
return this.animateAllAttrKeys(
|
||||||
{
|
{ exclude: ['arrow', 'rect', 'path', 'text'] },
|
||||||
include: ['circle'],
|
|
||||||
exclude: ['arrow', 'rect', 'path', 'text']
|
|
||||||
},
|
|
||||||
{ r: nodeRadius * 2 },
|
{ r: nodeRadius * 2 },
|
||||||
defaultTime * 2
|
defaultTime * 1.5
|
||||||
);
|
);
|
||||||
|
}, this))
|
||||||
|
// then shrink em super fast
|
||||||
|
.then(_.bind(function() {
|
||||||
|
return this.animateAllAttrKeys(
|
||||||
|
{ exclude: ['arrow', 'rect', 'path', 'text'] },
|
||||||
|
{ r: nodeRadius * 0.75 },
|
||||||
|
defaultTime * 0.5
|
||||||
|
);
|
||||||
|
}, this))
|
||||||
|
// then explode them and display text
|
||||||
|
.then(_.bind(function() {
|
||||||
|
makeText();
|
||||||
|
return this.explodeNodes();
|
||||||
}, this))
|
}, this))
|
||||||
.then(_.bind(function() {
|
.then(_.bind(function() {
|
||||||
return this.explodeNodes();
|
return this.explodeNodes();
|
||||||
|
}, this))
|
||||||
|
// then fade circles (aka everything) in and back
|
||||||
|
.then(_.bind(function() {
|
||||||
|
return this.animateAllAttrKeys(
|
||||||
|
{ exclude: ['arrow', 'rect', 'path', 'text'] },
|
||||||
|
{},
|
||||||
|
defaultTime * 1.25
|
||||||
|
);
|
||||||
|
}, this))
|
||||||
|
// then fade everything in and remove text
|
||||||
|
.then(_.bind(function() {
|
||||||
|
text.animate({ opacity: 0 }, defaultTime, undefined, undefined, function() {
|
||||||
|
text.remove();
|
||||||
|
});
|
||||||
|
return this.animateAllAttrKeys(
|
||||||
|
{},
|
||||||
|
{}
|
||||||
|
);
|
||||||
}, this))
|
}, this))
|
||||||
.fail(function(reason) {
|
.fail(function(reason) {
|
||||||
console.warn('Finish animation failed due to ', reason);
|
console.warn('Finish animation failed due to ', reason);
|
||||||
throw reason;
|
throw reason;
|
||||||
})
|
});
|
||||||
.done();
|
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve(); // start right away
|
||||||
return deferred;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.explodeNodes = function() {
|
GitVisuals.prototype.explodeNodes = function() {
|
||||||
|
@ -15507,6 +15614,7 @@ var VisBase = Backbone.Model.extend({
|
||||||
|
|
||||||
exports.VisBase = VisBase;
|
exports.VisBase = VisBase;
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
require("/src/js/visuals/tree.js");
|
require("/src/js/visuals/tree.js");
|
||||||
|
|
||||||
|
@ -16498,7 +16606,7 @@ var VisNode = VisBase.extend({
|
||||||
cy: y
|
cy: y
|
||||||
});
|
});
|
||||||
// continuation calculation
|
// continuation calculation
|
||||||
return (vx * vx + vy * vy > 0.01) ? true : false;
|
return ((vx * vx + vy * vy) > 0.01) ? true : false;
|
||||||
};
|
};
|
||||||
return stepFunc;
|
return stepFunc;
|
||||||
},
|
},
|
||||||
|
|
|
@ -143,37 +143,90 @@ GitVisuals.prototype.finishAnimation = function() {
|
||||||
var defaultTime = GRAPHICS.defaultAnimationTime;
|
var defaultTime = GRAPHICS.defaultAnimationTime;
|
||||||
var nodeRadius = GRAPHICS.nodeRadius;
|
var nodeRadius = GRAPHICS.nodeRadius;
|
||||||
|
|
||||||
deferred.promise.then(_.bind(function() {
|
var textString = 'Solved!!\n:D';
|
||||||
|
var text = null;
|
||||||
|
var makeText = _.bind(function() {
|
||||||
|
text = this.paper.text(
|
||||||
|
this.paper.width / 2,
|
||||||
|
this.paper.height / 2,
|
||||||
|
textString
|
||||||
|
);
|
||||||
|
text.attr({
|
||||||
|
opacity: 0,
|
||||||
|
'font-weight': 500,
|
||||||
|
'font-size': '32pt',
|
||||||
|
'font-family': 'Monaco, Courier, font-monospace',
|
||||||
|
stroke: '#000',
|
||||||
|
'stroke-width': 2,
|
||||||
|
fill: '#000'
|
||||||
|
});
|
||||||
|
text.animate({ opacity: 1 }, defaultTime);
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
// this is a BIG ANIMATION but it ends up just being
|
||||||
|
// a sweet chain of promises but is pretty nice. this is
|
||||||
|
// after I discovered promises / deferred's. Unfortunately
|
||||||
|
// I wrote a lot of the git stuff before promises, so
|
||||||
|
// that's somewhat ugly
|
||||||
|
|
||||||
|
deferred.promise
|
||||||
|
// first fade out everything but circles
|
||||||
|
.then(_.bind(function() {
|
||||||
return this.animateAllAttrKeys(
|
return this.animateAllAttrKeys(
|
||||||
{ exclude: ['circle'] },
|
{ exclude: ['circle'] },
|
||||||
{ opacity: 0 },
|
{ opacity: 0 },
|
||||||
defaultTime * 1.5
|
defaultTime * 1.1
|
||||||
);
|
);
|
||||||
|
|
||||||
}, this))
|
}, this))
|
||||||
|
// then make circle radii bigger
|
||||||
.then(_.bind(function() {
|
.then(_.bind(function() {
|
||||||
return this.animateAllAttrKeys(
|
return this.animateAllAttrKeys(
|
||||||
{
|
{ exclude: ['arrow', 'rect', 'path', 'text'] },
|
||||||
include: ['circle'],
|
|
||||||
exclude: ['arrow', 'rect', 'path', 'text']
|
|
||||||
},
|
|
||||||
{ r: nodeRadius * 2 },
|
{ r: nodeRadius * 2 },
|
||||||
defaultTime * 2
|
defaultTime * 1.5
|
||||||
);
|
);
|
||||||
|
}, this))
|
||||||
|
// then shrink em super fast
|
||||||
|
.then(_.bind(function() {
|
||||||
|
return this.animateAllAttrKeys(
|
||||||
|
{ exclude: ['arrow', 'rect', 'path', 'text'] },
|
||||||
|
{ r: nodeRadius * 0.75 },
|
||||||
|
defaultTime * 0.5
|
||||||
|
);
|
||||||
|
}, this))
|
||||||
|
// then explode them and display text
|
||||||
|
.then(_.bind(function() {
|
||||||
|
makeText();
|
||||||
|
return this.explodeNodes();
|
||||||
}, this))
|
}, this))
|
||||||
.then(_.bind(function() {
|
.then(_.bind(function() {
|
||||||
return this.explodeNodes();
|
return this.explodeNodes();
|
||||||
|
}, this))
|
||||||
|
// then fade circles (aka everything) in and back
|
||||||
|
.then(_.bind(function() {
|
||||||
|
return this.animateAllAttrKeys(
|
||||||
|
{ exclude: ['arrow', 'rect', 'path', 'text'] },
|
||||||
|
{},
|
||||||
|
defaultTime * 1.25
|
||||||
|
);
|
||||||
|
}, this))
|
||||||
|
// then fade everything in and remove text
|
||||||
|
.then(_.bind(function() {
|
||||||
|
text.animate({ opacity: 0 }, defaultTime, undefined, undefined, function() {
|
||||||
|
text.remove();
|
||||||
|
});
|
||||||
|
return this.animateAllAttrKeys(
|
||||||
|
{},
|
||||||
|
{}
|
||||||
|
);
|
||||||
}, this))
|
}, this))
|
||||||
.fail(function(reason) {
|
.fail(function(reason) {
|
||||||
console.warn('Finish animation failed due to ', reason);
|
console.warn('Finish animation failed due to ', reason);
|
||||||
throw reason;
|
throw reason;
|
||||||
})
|
});
|
||||||
.done();
|
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve(); // start right away
|
||||||
return deferred;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.explodeNodes = function() {
|
GitVisuals.prototype.explodeNodes = function() {
|
||||||
|
|
|
@ -42,3 +42,4 @@ var VisBase = Backbone.Model.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.VisBase = VisBase;
|
exports.VisBase = VisBase;
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,7 @@ var VisNode = VisBase.extend({
|
||||||
cy: y
|
cy: y
|
||||||
});
|
});
|
||||||
// continuation calculation
|
// continuation calculation
|
||||||
return (vx * vx + vy * vy > 0.01) ? true : false;
|
return ((vx * vx + vy * vy) > 0.01) ? true : false;
|
||||||
};
|
};
|
||||||
return stepFunc;
|
return stepFunc;
|
||||||
},
|
},
|
||||||
|
|
2
todo.txt
2
todo.txt
|
@ -9,7 +9,6 @@ Big Graphic things:
|
||||||
|
|
||||||
Medium things:
|
Medium things:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
[ ] level finish animation
|
|
||||||
[ ] check animations
|
[ ] check animations
|
||||||
[ ] view for anything above the fold
|
[ ] view for anything above the fold
|
||||||
[ ] rebase styling (get it better. even cuter -- make it like a command window)
|
[ ] rebase styling (get it better. even cuter -- make it like a command window)
|
||||||
|
@ -34,6 +33,7 @@ Big Bugs to fix:
|
||||||
Done things:
|
Done things:
|
||||||
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
[x] level finish animation
|
||||||
[x] refactor visualization
|
[x] refactor visualization
|
||||||
[x] aliases replace when put into commands
|
[x] aliases replace when put into commands
|
||||||
[x] headless Git for testing (send it commands and expected trees)
|
[x] headless Git for testing (send it commands and expected trees)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue