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

Method update

packages/player/src/shader-loader-state.ts:57–112  ·  view source on GitHub ↗
(status: ShaderTransitionState, loadingMode: string)

Source from the content-addressed store, hash-verified

55 }
56
57 update(status: ShaderTransitionState, loadingMode: string): void {
58 if (loadingMode !== "player") {
59 this.reset();
60 return;
61 }
62 if (status.ready || !status.loading) {
63 this.hide();
64 return;
65 }
66
67 const progress =
68 typeof status.progress === "number" && Number.isFinite(status.progress) ? status.progress : 0;
69 const total =
70 typeof status.total === "number" && Number.isFinite(status.total) ? status.total : 0;
71 const ratio = total > 0 ? Math.min(1, Math.max(0, progress / total)) : 0;
72
73 const phraseIndex = Math.min(
74 SHADER_LOADING_PHRASES.length - 1,
75 Math.floor(ratio * SHADER_LOADING_PHRASES.length),
76 );
77 this._el.title.textContent =
78 SHADER_LOADING_PHRASES[phraseIndex] || "Preparing scene transitions";
79
80 this._el.detail.textContent =
81 status.phase === "cached"
82 ? "Loading cached transition frames before playback."
83 : status.phase === "finalizing"
84 ? "Uploading transition textures for smooth playback."
85 : "Rendering animated scene samples for shader transitions.";
86
87 this._el.fill.style.transform = `scaleX(${ratio})`;
88
89 this._el.transitionValue.textContent =
90 status.currentTransition !== undefined && status.transitionTotal !== undefined
91 ? `${status.currentTransition}/${status.transitionTotal}`
92 : total > 0
93 ? `${progress}/${total}`
94 : "";
95
96 const frameValue =
97 status.transitionFrame !== undefined && status.transitionFrames !== undefined
98 ? `${status.transitionFrame}/${status.transitionFrames}`
99 : "";
100
101 this._el.frameLabel.textContent =
102 status.phase === "cached"
103 ? "cached transition frames"
104 : status.phase === "finalizing"
105 ? "finalizing transition frames"
106 : "rendering transition frames";
107
108 this._el.frameValue.textContent = frameValue;
109 this._el.frameRow.style.visibility = frameValue ? "visible" : "hidden";
110 this._el.root.setAttribute("aria-valuenow", String(Math.round(ratio * 100)));
111 this.show();
112 }
113
114 get hideTimeout(): ReturnType<typeof setTimeout> | null {

Callers 15

setShaderReadyStateFunction · 0.80
generateThumbnailFunction · 0.80
sha256Function · 0.80
computePreparedGifHashFunction · 0.80
preparedGifCachePathFunction · 0.80
subsetTokenFunction · 0.80
hashProjectDirFunction · 0.80
computePlanHashFunction · 0.80
sha256HexFunction · 0.80

Calls 4

resetMethod · 0.95
hideMethod · 0.95
showMethod · 0.95
setAttributeMethod · 0.65

Tested by 1

preparedGifCachePathFunction · 0.64