MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / writeMotionPathValue

Function writeMotionPathValue

packages/parsers/src/gsapParser.ts:2949–2962  ·  view source on GitHub ↗
(
  loc: NonNullable<ReturnType<typeof locateAnimation>>,
  waypoints: Array<{ x: number; y: number }>,
  segments: ArcPathSegment[],
  autoRotate: boolean | number,
)

Source from the content-addressed store, hash-verified

2947}
2948
2949function writeMotionPathValue(
2950 loc: NonNullable<ReturnType<typeof locateAnimation>>,
2951 waypoints: Array<{ x: number; y: number }>,
2952 segments: ArcPathSegment[],
2953 autoRotate: boolean | number,
2954): string {
2955 const motionPathCode = buildMotionPathObjectCode({ waypoints, segments, autoRotate });
2956 const varsArg = loc.target.call.varsArg;
2957 const existingProp = varsArg.properties.find(
2958 (p: AstNode) => isObjectProperty(p) && propKeyName(p) === "motionPath",
2959 );
2960 if (existingProp) existingProp.value = parseExpr(motionPathCode);
2961 return recast.print(loc.parsed.ast).code;
2962}
2963
2964/**
2965 * Insert a waypoint at `index` (between existing anchors), splitting the segment

Callers 2

Calls 5

parseExprFunction · 0.85
isObjectPropertyFunction · 0.70
propKeyNameFunction · 0.70
findMethod · 0.65

Tested by

no test coverage detected