Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit 60e1be4

Browse files
committed
## UPDATE
* fix(delay): delay now adds only at start * fix(plugins): fixed `Transform` plugin * feat(Composite): added `#fetch` method * feat(plugins): added `Filter` plugin
1 parent 8ab9772 commit 60e1be4

File tree

8 files changed

+259
-90
lines changed

8 files changed

+259
-90
lines changed

dist/Tween.js

Lines changed: 134 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/Tween.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/Tween.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/test.html

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,28 @@
4848

4949
const Style = TWEEN.Plugins.DOM;
5050

51+
const { Plugins } = TWEEN;
52+
53+
class Morph extends Plugins {
54+
static Morph(Composite) {
55+
let layer = Composite.domNode,
56+
style = layer.style;
57+
return {
58+
update(Tween, RenderObject) {
59+
let filter = '';
60+
for (let p in RenderObject) {
61+
if (p.indexOf('blur') !== -1 || p.indexOf('rotate') !== -1 || p.indexOf('shadow') !== -1 || p.indexOf('brightness') !== -1) {
62+
filter += ` ${ p }( ${ RenderObject[p] })`;
63+
}
64+
}
65+
if (filter) {
66+
style.filter = filter;
67+
}
68+
}
69+
}
70+
}
71+
}
72+
5173
function createTest(count) {
5274
var i;
5375
for (i = 0; i < count; i++) {
@@ -62,10 +84,10 @@
6284
div.style.transform = "translate3d(" + -hwiw + "px, 0px, 0px)";
6385
//div.style.left = l + "px";
6486
div.style.backgroundColor = bgC;
65-
var layer = new TWEEN.Composite(div).applyPlugin('DOM');
66-
var a = new TWEEN.Tween({ transform: `translate3d(${ -hwiw }px, 0px, 0px)` }).to({
67-
transform: `translate3d(${hwiw}px, 0px, 0px)`
68-
}, 1000).easing(TWEEN.Easing.Circular.InOut).on('update', layer.render).repeat(Infinity).yoyo(true);
87+
var layer = new TWEEN.Composite(div).applyPlugin('Transform');
88+
var a = new TWEEN.Tween({ x: -hwiw + 'px' }).to({
89+
x: hwiw + 'px'
90+
}, 1000).easing(TWEEN.Easing.Circular.InOut).on('update', layer.render).delay(15).repeat(Infinity).yoyo(true);
6991
nodes.push({ layer: layer, node: div, tween: a });
7092

7193
}
@@ -74,7 +96,7 @@
7496
}).map((node, i) => {
7597
frag.appendChild(node.node);
7698
node.tween.delay(delay => {
77-
return (i * (i % 2 ? 15 : -15));
99+
return (i * (i % 2 ? delay : -delay));
78100
}).start();
79101
})
80102
c.appendChild(frag);

package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "es6-tween",
3-
"version": "1.10.6",
3+
"version": "1.11.1",
44
"description": "ES6 implementation of amazing tween.js",
55
"main": "dist/Tween.js",
66
"directories": {
@@ -17,10 +17,6 @@
1717
"test-correctness": "jshint --config test/jshintrc src/Tween.js",
1818
"test-style": "jscs --config test/jscs.json src/Tween.js"
1919
},
20-
"release": {
21-
"debug": false,
22-
"githubToken": "00000"
23-
},
2420
"repository": {
2521
"type": "git",
2622
"url": "git+https://github.com/tweenjs/es6-tween.git"
@@ -34,7 +30,7 @@
3430
"easing",
3531
"emit"
3632
],
37-
"author": "sole, dalisoft",
33+
"author": "es6-tween contributors",
3834
"license": "MIT",
3935
"bugs": {
4036
"url": "https://github.com/tweenjs/es6-tween/issues"
@@ -56,8 +52,7 @@
5652
"yargs": "6.6.0",
5753
"jscs": "^2.2.0",
5854
"jshint": "^2.8.0",
59-
"nodeunit": "^0.9.1",
60-
"semantic-release": "^6.3.2"
55+
"nodeunit": "^0.9.1"
6156
},
6257
"dependencies": {}
6358
}

src/dist/Composite.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@ export default class Composite {
2222
return this;
2323
};
2424

25+
this.fetch = function () {
26+
27+
if (Object.keys(this.object).length) {
28+
29+
return this;
30+
31+
}
32+
33+
for (let p in pluginList) {
34+
35+
pluginList[p] && pluginList[p].fetch && pluginList[p].fetch(this);
36+
37+
}
38+
39+
return this;
40+
};
41+
2542
this.init = function (object) {
2643

2744
for (let p in pluginList) {

0 commit comments

Comments
 (0)