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

Method applyState

packages/2d/src/lib/components/Node.ts:1815–1838  ·  view source on GitHub ↗
(
    state: NodeState,
    duration?: number,
    timing: TimingFunction = easeInOutCubic,
  )

Source from the content-addressed store, hash-verified

1813 timing?: TimingFunction,
1814 ): ThreadGenerator;
1815 public applyState(
1816 state: NodeState,
1817 duration?: number,
1818 timing: TimingFunction = easeInOutCubic,
1819 ): ThreadGenerator | void {
1820 if (duration === undefined) {
1821 for (const key in state) {
1822 const signal = this.signalByKey(key);
1823 if (signal) {
1824 signal(state[key]);
1825 }
1826 }
1827 }
1828
1829 const tasks: ThreadGenerator[] = [];
1830 for (const key in state) {
1831 const signal = this.signalByKey(key);
1832 if (state[key] !== signal.context.raw()) {
1833 tasks.push(signal(state[key], duration!, timing));
1834 }
1835 }
1836
1837 return all(...tasks);
1838 }
1839
1840 /**
1841 * Push a snapshot of the node's current state onto the node's state stack.

Callers 1

restoreMethod · 0.95

Calls 4

signalByKeyMethod · 0.95
signalFunction · 0.90
allFunction · 0.90
rawMethod · 0.45

Tested by

no test coverage detected