style(core): format the seek re-render change

This commit is contained in:
Miguel Angel Simon Sierra
2026-10-03 03:49:47 -07:00
parent 834d746ec8
commit 6d25d04ad5
2 changed files with 18 additions and 10 deletions
@@ -63,13 +63,18 @@ describe("gsap adapter on a step", () => {
describe("gsap adapter at a tween's start", () => {
// An edit at 2 s turns the later tween into keyframes; its first keyframe must win over the from() end.
it.each([0, 1, 2.5, 3])("shows the tween that starts at the seek time, seeking from %s s", (from) => {
const box = document.body.appendChild(document.createElement("div"));
const timeline = gsap.timeline({ paused: true });
timeline.from(box, { x: -60, duration: 2, ease: "none" }, 0);
timeline.to(box, { keyframes: { "0%": { x: 5 }, "100%": { x: 60 } }, duration: 1 }, 2);
timeline.totalTime(from, true);
createGsapAdapter({ getTimeline: () => timeline as unknown as RuntimeTimelineLike }).seek({ time: 2 });
expect(gsap.getProperty(box, "x")).toBe(5);
});
it.each([0, 1, 2.5, 3])(
"shows the tween that starts at the seek time, seeking from %s s",
(from) => {
const box = document.body.appendChild(document.createElement("div"));
const timeline = gsap.timeline({ paused: true });
timeline.from(box, { x: -60, duration: 2, ease: "none" }, 0);
timeline.to(box, { keyframes: { "0%": { x: 5 }, "100%": { x: 60 } }, duration: 1 }, 2);
timeline.totalTime(from, true);
createGsapAdapter({ getTimeline: () => timeline as unknown as RuntimeTimelineLike }).seek({
time: 2,
});
expect(gsap.getProperty(box, "x")).toBe(5);
},
);
});
+4 -1
View File
@@ -8,7 +8,10 @@ type GsapAdapterDeps = {
* Re-renders a timeline already at `t`, silently. A forced render at the same time walks the children
* forward in authored order and re-renders each one, including a child that starts exactly at `t`.
*/
export function rerenderGsapTimelineAt(timeline: Pick<RuntimeTimelineLike, "render">, t: number): void {
export function rerenderGsapTimelineAt(
timeline: Pick<RuntimeTimelineLike, "render">,
t: number,
): void {
timeline.render?.(t, true, true);
}