Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function measure(d) {
// Use native browser measurement if running in browser
if (typeof window !== "undefined" && window && window.document) {
try {
let path = window.document.createElementNS(
"http://www.w3.org/2000/svg",
"path"
);
path.setAttributeNS(null, "d", d);
return path;
} catch (e) {}
}
// Fall back to svg-path-properties
return svgPathProperties(d);
}
function createLineProps (path) {
const properties = svgPathProperties (path);
const length = properties.getTotalLength ();
console.log ('the length', length);
return {
d: path,
strokeDashoffset: new Animated.Value (length),
strokeDasharray: [length, length],
};
}
constructor(props) {
super(props);
const { d } = this.props;
const properties = svgPathProperties(d)
this.length = properties.getTotalLength();
this.strokeDashoffset = new Animated.Value(this.length);
}
function createLineProps(path) {
const properties = svgPathProperties(path);
const length = properties.getTotalLength();
return {
d: path,
strokeDashoffset: new Animated.Value(length),
strokeDasharray: [length, length]
};
}
componentWillReceiveProps(nextProps) {
if (nextProps.d !== this.props.d) {
this.properties = svgPathProperties(nextProps.d);
this.length = this.properties.getTotalLength();
}
}
render() {
renderDrawPath(
{ type = this.state.type, animType = this.state.animType } = {}
) {
if (type !== 'path' && animType !== 'drawpath') {
return null;
}
const properties = svgPathProperties(VivusHi);
const length = properties.getTotalLength();
const sdo = new Animated.Value(length);
Animated.sequence([
Animated.delay(1000),
Animated.timing(sdo, { toValue: 0, duration: 2000 })
]).start();
return (
constructor(props) {
super(props);
this.properties = svgPathProperties(props.d);
this.length = this.properties.getTotalLength();
}
setNativeProps(props) {