Skip to content

Commit

Permalink
build: update build
Browse files Browse the repository at this point in the history
  • Loading branch information
kmkzt committed Jun 10, 2019
1 parent 06ad3bc commit 6931e20
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
10 changes: 5 additions & 5 deletions docs/main.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/main.bundle.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/SvgAnimation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export declare class SvgAnimation extends Two {
private animationStart;
initSvgXml(svgNode: SVGElement): void;
strokeAnimation(): () => this;
splitEnd(p: number): void;
}
37 changes: 19 additions & 18 deletions lib/SvgAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var SvgAnimation = (function (_super) {
_this.strokeAnimation = _this.strokeAnimation.bind(_this);
_this.loadScene = _this.loadScene.bind(_this);
_this.loadSvgXml = _this.loadSvgXml.bind(_this);
_this.splitEnd = _this.splitEnd.bind(_this);
_this.shakingRange = params.shakingRange || 2;
_this.type = params.type || Two.Types.canvas;
_this.el = params.el;
Expand Down Expand Up @@ -129,39 +130,39 @@ var SvgAnimation = (function (_super) {
};
SvgAnimation.prototype.strokeAnimation = function () {
var _this = this;
var distances = calculateDistances(this.scene);
var total = distances.reduce(function (to, d) { return to + d; }, 0);
var setEnding = function (group, ti) {
var traversed = ti * total;
var current = 0;
group.children.map(function (child, i) {
var distance = distances[i];
var min = current;
var max = current + distance;
child.ending = cmap(traversed, min, max, 0, 1);
current = max;
});
};
var t = 0;
var update = function () {
var arg = [];
for (var _i = 0; _i < arguments.length; _i++) {
arg[_i] = arguments[_i];
}
if (t < 0.9999) {
t += 0.00625;
}
else {
t = 0;
}
setEnding(_this.scene, t);
setEndScene(_this.scene, t);
};
this.bind('update', update).play();
return function () { return _this.unbind('update', update); };
};
SvgAnimation.prototype.splitEnd = function (p) {
setEndScene(this.scene, p);
this.update();
};
return SvgAnimation;
}(Two));
export { SvgAnimation };
var setEndScene = function (group, ti) {
var distances = calculateDistances(group);
var total = distances.reduce(function (to, d) { return to + d; }, 0);
var traversed = ti * total;
var current = 0;
for (var i = 0; i < group.children.length; i++) {
var distance = distances[i];
var min = current;
var max = current + distance;
group.children[i].ending = cmap(traversed, min, max, 0, 1);
current = max;
}
};
function calculateDistances(group) {
return group.children.reduce(function (distances, child) {
var d = 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6931e20

Please sign in to comment.