mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/RoboCommander.git
synced 2026-06-19 07:56:13 +00:00
Initial commit
This commit is contained in:
32
node_modules/d3-transition/src/transition/attrTween.js
generated
vendored
Normal file
32
node_modules/d3-transition/src/transition/attrTween.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import {namespace} from "d3-selection";
|
||||
|
||||
function attrTweenNS(fullname, value) {
|
||||
function tween() {
|
||||
var node = this, i = value.apply(node, arguments);
|
||||
return i && function(t) {
|
||||
node.setAttributeNS(fullname.space, fullname.local, i(t));
|
||||
};
|
||||
}
|
||||
tween._value = value;
|
||||
return tween;
|
||||
}
|
||||
|
||||
function attrTween(name, value) {
|
||||
function tween() {
|
||||
var node = this, i = value.apply(node, arguments);
|
||||
return i && function(t) {
|
||||
node.setAttribute(name, i(t));
|
||||
};
|
||||
}
|
||||
tween._value = value;
|
||||
return tween;
|
||||
}
|
||||
|
||||
export default function(name, value) {
|
||||
var key = "attr." + name;
|
||||
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
||||
if (value == null) return this.tween(key, null);
|
||||
if (typeof value !== "function") throw new Error;
|
||||
var fullname = namespace(name);
|
||||
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
|
||||
}
|
||||
Reference in New Issue
Block a user