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

Function createDurationFloorTimeline

packages/core/src/runtime/init.ts:799–827  ·  view source on GitHub ↗
(
      durationSeconds: number,
      existingRootTimeline: RuntimeTimelineLike | null,
    )

Source from the content-addressed store, hash-verified

797 return compositeTimeline;
798 };
799 const createDurationFloorTimeline = (
800 durationSeconds: number,
801 existingRootTimeline: RuntimeTimelineLike | null,
802 ): RuntimeTimelineLike | null => {
803 if (!isUsableTimelineDuration(durationSeconds)) return null;
804 const gsapApi = window.gsap;
805 if (!gsapApi || typeof gsapApi.timeline !== "function") return null;
806 const fallbackTimeline = gsapApi.timeline({ paused: true }) as RuntimeTimelineLike;
807 if (existingRootTimeline) {
808 try {
809 fallbackTimeline.add(existingRootTimeline, 0);
810 } catch (err) {
811 // keep fallback resilient if root add fails
812 swallow("runtime.init.site2", err);
813 }
814 }
815 const withTween = fallbackTimeline as RuntimeTimelineLike & {
816 to?: (target: object, vars: { duration?: number }) => unknown;
817 };
818 if (typeof withTween.to === "function") {
819 try {
820 withTween.to({}, { duration: durationSeconds });
821 } catch (err) {
822 // no-op; if tween creation fails, caller will discard by unusable duration
823 swallow("runtime.init.site3", err);
824 }
825 }
826 return fallbackTimeline;
827 };
828 const addMissingChildCandidatesToRootTimeline = (
829 rootTimeline: RuntimeTimelineLike,
830 candidates: Array<{

Callers 1

Calls 5

swallowFunction · 0.90
isUsableTimelineDurationFunction · 0.85
timelineMethod · 0.80
addMethod · 0.80
toMethod · 0.80

Tested by

no test coverage detected