MCPcopy Index your code
hub / github.com/tsoding/button / frame

Function frame

index.js:233–246  ·  view source on GitHub ↗
(timestamp)

Source from the content-addressed store, hash-verified

231
232let prevTimestamp = 0;
233function frame(timestamp) {
234 const deltaTime = (timestamp - prevTimestamp)/1000;
235 prevTimestamp = timestamp;
236 if (shaking) {
237 const x = Math.random()*2 - 1 + 50;
238 const y = Math.random()*2 - 1 + 50;
239 clickMe.style.left = `${x}%`;
240 clickMe.style.top = `${y}%`;
241 } else {
242 clickMe.style.left = "50%";
243 clickMe.style.top = "50%";
244 }
245 window.requestAnimationFrame(frame);
246}
247window.requestAnimationFrame((timestamp) => {
248 prevTimestamp = timestamp;
249 window.requestAnimationFrame(frame);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…