MCPcopy Create free account
hub / github.com/dailydotdev/apps / play

Function play

packages/shared/src/features/patchy/patchyIdle.ts:122–142  ·  view source on GitHub ↗
(name: PatchyIdleActionName)

Source from the content-addressed store, hash-verified

120 timers.add(id);
121 };
122 const play = (name: PatchyIdleActionName) => {
123 if (document.hidden) {
124 return;
125 }
126 const action: PatchyIdleAction = patchyIdleActions[name];
127 isBusy = true;
128 keyRef.current += 1;
129 setState({
130 face: action.face,
131 // Animated faces bring their own motion.
132 motion:
133 prefersReducedMotion || isPatchyFaceAnimated(action.face)
134 ? null
135 : (action.motion ?? null),
136 key: keyRef.current,
137 });
138 later(() => {
139 isBusy = false;
140 setState((current) => ({ ...current, face: null, motion: null }));
141 }, action.ms);
142 };
143 const blinkLoop = () => {
144 later(() => {
145 if (!isBusy) {

Callers 3

blinkLoopFunction · 0.70
actionLoopFunction · 0.70
onPointerOverFunction · 0.70

Calls 2

isPatchyFaceAnimatedFunction · 0.90
laterFunction · 0.85

Tested by

no test coverage detected