Skip to content

Commit 375d1ca

Browse files
committed
fix(studio): match a parsed tween on any target, and check a later keyframe channel's start
1 parent 4312326 commit 375d1ca

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎packages/studio/src/hooks/gsapParsedTween.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function findParsedTween(
7272
const keyframed = Boolean(anim.keyframes);
7373
for (const timeline of Object.values(win.__timelines)) {
7474
for (const tween of timeline?.getChildren?.(true) ?? []) {
75-
const targets = elementTargets(tween);
75+
const targets = (tween.targets?.() ?? []) as Array<{ id?: unknown }>;
7676
if (!targets.includes(element) && !targets.some((t) => element.id && t.id === element.id))
7777
continue;
7878
if (!startsAt(tween, start)) continue;

‎packages/studio/src/hooks/gsapValueAtPlayhead.realGsap.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@ it("keeps a layer's other transform values while reading an unplayed tween", ()
156156
transformOrigin: "20px 30px 40px",
157157
});
158158

159-
findParsedTween(iframe, box, parseGsapScriptAcorn(src).animations[0]!);
159+
const tween = findParsedTween(iframe, box, parseGsapScriptAcorn(src).animations[0]!);
160160
timeline.kill();
161161

162+
expect(parsedImplicitEndValue(tween)("x", "start")).toBe(0);
162163
const values = ["x", "skewX", "rotationX", "xPercent", "transformOrigin"];
163164
expect(values.map((p) => gsap.getProperty(box, p))).toEqual([77, 23, 19, 12, "20px 30px 40px"]);
164165
});

0 commit comments

Comments
 (0)