MCPcopy
hub / github.com/midrender/revideo / replaceTween

Method replaceTween

packages/2d/src/lib/code/CodeSignal.ts:222–246  ·  view source on GitHub ↗
(range: CodeRange, code: string, duration: number)

Source from the content-addressed store, hash-verified

220 }
221
222 private *replaceTween(range: CodeRange, code: string, duration: number) {
223 let current = this.get();
224 const [fragments, index] = extractRange(range, current.fragments);
225 const progress = createSignal(0);
226 const scope = {
227 progress,
228 fragments: [replace(fragments[index] as string, code)],
229 };
230 fragments[index] = scope;
231 this.set({
232 progress: current.progress,
233 fragments,
234 });
235
236 yield* progress(1, duration);
237
238 current = this.get();
239 this.set({
240 progress: current.progress,
241 fragments: current.fragments.map(fragment =>
242 fragment === scope ? code : fragment,
243 ),
244 });
245 progress.context.dispose();
246 }
247
248 private *editTween(value: CodeTag[], duration: number) {
249 this.progress(0);

Callers 1

replaceMethod · 0.95

Calls 6

extractRangeFunction · 0.90
createSignalFunction · 0.90
replaceFunction · 0.90
setMethod · 0.65
getMethod · 0.45
disposeMethod · 0.45

Tested by

no test coverage detected