Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const getPointAtLength = (
parts: ReanimatedPath,
length: Animated.Node
): { x: Animated.Node; y: Animated.Node } => {
const notFound: Animated.Node = new Value(-1);
const index = parts.segments.reduce(
(acc, p, i) =>
cond(and(greaterOrEq(length, p.start), lessOrEq(length, p.end)), i, acc),
notFound
);
const start = find(parts.start, index);
const end = find(parts.end, index);
const p0x = find(parts.p0x, index);
const p1x = find(parts.p1x, index);
const p2x = find(parts.p2x, index);
const p3x = find(parts.p3x, index);
const p0y = find(parts.p0y, index);
const p1y = find(parts.p1y, index);
const p2y = find(parts.p2y, index);
const p3y = find(parts.p3y, index);
const t = interpolate(length, {
inputRange: [start, end],
outputRange: [0, 1]
});
return {
x: cubicBezier(t, p0x, p1x, p2x, p3x),
y: cubicBezier(t, p0y, p1y, p2y, p3y)
};
};
export const getPointAtLength = (
parts: ReanimatedPath,
length: Animated.Node
): { x: Animated.Node; y: Animated.Node } => {
const notFound: Animated.Node = new Value(-1);
const index = parts.segments.reduce(
(acc, p, i) =>
cond(and(greaterOrEq(length, p.start), lessOrEq(length, p.end)), i, acc),
notFound
);
const start = find(parts.start, index);
const end = find(parts.end, index);
const p0x = find(parts.p0x, index);
const p1x = find(parts.p1x, index);
const p2x = find(parts.p2x, index);
const p3x = find(parts.p3x, index);
const p0y = find(parts.p0y, index);
const p1y = find(parts.p1y, index);
const p2y = find(parts.p2y, index);
const p3y = find(parts.p3y, index);
const t = interpolate(length, {
inputRange: [start, end],
outputRange: [0, 1]
});
return {
x: cubicBezier(t, p0x, p1x, p2x, p3x),
y: cubicBezier(t, p0y, p1y, p2y, p3y)
};
export const getPointAtLength = (
parts: ReanimatedPath,
length: Animated.Node
): { x: Animated.Node; y: Animated.Node } => {
const notFound: Animated.Node = new Value(-1);
const index = parts.segments.reduce(
(acc, p, i) =>
cond(and(greaterOrEq(length, p.start), lessOrEq(length, p.end)), i, acc),
notFound
);
const start = find(parts.start, index);
const end = find(parts.end, index);
const p0x = find(parts.p0x, index);
const p1x = find(parts.p1x, index);
const p2x = find(parts.p2x, index);
const p3x = find(parts.p3x, index);
const p0y = find(parts.p0y, index);
const p1y = find(parts.p1y, index);
const p2y = find(parts.p2y, index);
const p3y = find(parts.p3y, index);
const t = interpolate(length, {
inputRange: [start, end],
outputRange: [0, 1]
});
return {
x: cubicBezier(t, p0x, p1x, p2x, p3x),
y: cubicBezier(t, p0y, p1y, p2y, p3y)
};
};
const index = parts.segments.reduce(
(acc, p, i) =>
cond(and(greaterOrEq(length, p.start), lessOrEq(length, p.end)), i, acc),
notFound
);
const start = find(parts.start, index);
const end = find(parts.end, index);
const p0x = find(parts.p0x, index);
const p1x = find(parts.p1x, index);
const p2x = find(parts.p2x, index);
const p3x = find(parts.p3x, index);
const p0y = find(parts.p0y, index);
const p1y = find(parts.p1y, index);
const p2y = find(parts.p2y, index);
const p3y = find(parts.p3y, index);
const t = interpolate(length, {
inputRange: [start, end],
outputRange: [0, 1]
});
return {
x: cubicBezier(t, p0x, p1x, p2x, p3x),
y: cubicBezier(t, p0y, p1y, p2y, p3y)
};
};
const notFound: Animated.Node = new Value(-1);
const index = parts.segments.reduce(
(acc, p, i) =>
cond(and(greaterOrEq(length, p.start), lessOrEq(length, p.end)), i, acc),
notFound
);
const start = find(parts.start, index);
const end = find(parts.end, index);
const p0x = find(parts.p0x, index);
const p1x = find(parts.p1x, index);
const p2x = find(parts.p2x, index);
const p3x = find(parts.p3x, index);
const p0y = find(parts.p0y, index);
const p1y = find(parts.p1y, index);
const p2y = find(parts.p2y, index);
const p3y = find(parts.p3y, index);
const t = interpolate(length, {
inputRange: [start, end],
outputRange: [0, 1]
});
return {
x: cubicBezier(t, p0x, p1x, p2x, p3x),
y: cubicBezier(t, p0y, p1y, p2y, p3y)
};
};
export const getPointAtLength = (
parts: ReanimatedPath,
length: Animated.Node
): { x: Animated.Node; y: Animated.Node } => {
const notFound: Animated.Node = new Value(-1);
const index = parts.segments.reduce(
(acc, p, i) =>
cond(and(greaterOrEq(length, p.start), lessOrEq(length, p.end)), i, acc),
notFound
);
const start = find(parts.start, index);
const end = find(parts.end, index);
const p0x = find(parts.p0x, index);
const p1x = find(parts.p1x, index);
const p2x = find(parts.p2x, index);
const p3x = find(parts.p3x, index);
const p0y = find(parts.p0y, index);
const p1y = find(parts.p1y, index);
const p2y = find(parts.p2y, index);
const p3y = find(parts.p3y, index);
const t = interpolate(length, {
inputRange: [start, end],
outputRange: [0, 1]
});
return {
(acc, p, i) =>
cond(and(greaterOrEq(length, p.start), lessOrEq(length, p.end)), i, acc),
notFound
);
const start = find(parts.start, index);
const end = find(parts.end, index);
const p0x = find(parts.p0x, index);
const p1x = find(parts.p1x, index);
const p2x = find(parts.p2x, index);
const p3x = find(parts.p3x, index);
const p0y = find(parts.p0y, index);
const p1y = find(parts.p1y, index);
const p2y = find(parts.p2y, index);
const p3y = find(parts.p3y, index);
const t = interpolate(length, {
inputRange: [start, end],
outputRange: [0, 1]
});
return {
x: cubicBezier(t, p0x, p1x, p2x, p3x),
y: cubicBezier(t, p0y, p1y, p2y, p3y)
};
};
parts: ReanimatedPath,
length: Animated.Node
): { x: Animated.Node; y: Animated.Node } => {
const notFound: Animated.Node = new Value(-1);
const index = parts.segments.reduce(
(acc, p, i) =>
cond(and(greaterOrEq(length, p.start), lessOrEq(length, p.end)), i, acc),
notFound
);
const start = find(parts.start, index);
const end = find(parts.end, index);
const p0x = find(parts.p0x, index);
const p1x = find(parts.p1x, index);
const p2x = find(parts.p2x, index);
const p3x = find(parts.p3x, index);
const p0y = find(parts.p0y, index);
const p1y = find(parts.p1y, index);
const p2y = find(parts.p2y, index);
const p3y = find(parts.p3y, index);
const t = interpolate(length, {
inputRange: [start, end],
outputRange: [0, 1]
});
return {
x: cubicBezier(t, p0x, p1x, p2x, p3x),
y: cubicBezier(t, p0y, p1y, p2y, p3y)
};
};
): { x: Animated.Node; y: Animated.Node } => {
const notFound: Animated.Node = new Value(-1);
const index = parts.segments.reduce(
(acc, p, i) =>
cond(and(greaterOrEq(length, p.start), lessOrEq(length, p.end)), i, acc),
notFound
);
const start = find(parts.start, index);
const end = find(parts.end, index);
const p0x = find(parts.p0x, index);
const p1x = find(parts.p1x, index);
const p2x = find(parts.p2x, index);
const p3x = find(parts.p3x, index);
const p0y = find(parts.p0y, index);
const p1y = find(parts.p1y, index);
const p2y = find(parts.p2y, index);
const p3y = find(parts.p3y, index);
const t = interpolate(length, {
inputRange: [start, end],
outputRange: [0, 1]
});
return {
x: cubicBezier(t, p0x, p1x, p2x, p3x),
y: cubicBezier(t, p0y, p1y, p2y, p3y)
};
};
export const getPointAtLength = (
parts: ReanimatedPath,
length: Animated.Node
): { x: Animated.Node; y: Animated.Node } => {
const notFound: Animated.Node = new Value(-1);
const index = parts.segments.reduce(
(acc, p, i) =>
cond(and(greaterOrEq(length, p.start), lessOrEq(length, p.end)), i, acc),
notFound
);
const start = find(parts.start, index);
const end = find(parts.end, index);
const p0x = find(parts.p0x, index);
const p1x = find(parts.p1x, index);
const p2x = find(parts.p2x, index);
const p3x = find(parts.p3x, index);
const p0y = find(parts.p0y, index);
const p1y = find(parts.p1y, index);
const p2y = find(parts.p2y, index);
const p3y = find(parts.p3y, index);
const t = interpolate(length, {
inputRange: [start, end],
outputRange: [0, 1]
});
return {
x: cubicBezier(t, p0x, p1x, p2x, p3x),