iwmlib/lib/3rdparty/greensock/src/esm/AttrPlugin.js

44 lines
1.1 KiB
JavaScript

/*!
* VERSION: 0.6.1
* DATE: 2018-08-27
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
* This work is subject to the terms at http://greensock.com/standard-license or for
* Club GreenSock members, the software agreement that was issued with your membership.
*
* @author: Jack Doyle, jack@greensock.com
*/
/* eslint-disable */
import { _gsScope } from "./TweenLite.js";
export var AttrPlugin = _gsScope._gsDefine.plugin({
propName: "attr",
API: 2,
version: "0.6.1",
//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
init: function(target, value, tween, index) {
var p, end;
if (typeof(target.setAttribute) !== "function") {
return false;
}
for (p in value) {
end = value[p];
if (typeof(end) === "function") {
end = end(index, target);
}
this._addTween(target, "setAttribute", target.getAttribute(p) + "", end + "", p, false, p);
this._overwriteProps.push(p);
}
return true;
}
});
export { AttrPlugin as default };