-
Notifications
You must be signed in to change notification settings - Fork 8
/
gsap-react-plugin.js
46 lines (43 loc) · 1.2 KB
/
gsap-react-plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var __hasProp = {}.hasOwnProperty;
if (window._gsQueue == null) {
window._gsQueue = [];
}
window._gsQueue.push(function() {
return window._gsDefine.plugin({
propName: 'state',
API: 2,
version: '1.0.2',
init: function(target, value, tween) {
var end, p, start, _ref, _ref1, _ref2;
if (typeof target.setState !== 'function') {
return false;
}
if (target._tweenState == null) {
target._tweenState = {};
}
this._tween = {};
for (p in value) {
if (!__hasProp.call(value, p)) continue;
end = value[p];
start = (_ref = (_ref1 = (_ref2 = target.state) != null ? _ref2[p] : void 0) != null ? _ref1 : target._tweenState[p]) != null ? _ref : end;
this._tween[p] = start;
this._addTween(this._tween, p, start, end, p);
}
this._target = target;
return true;
},
set: function(ratio) {
var k, v, _ref;
this._super.setRatio.call(this, ratio);
_ref = this._tween;
for (k in _ref) {
v = _ref[k];
this._target._tweenState[k] = v;
}
return this._target.setState(this._tween);
}
});
});
if (window._gsDefine) {
window._gsQueue.pop()();
}