MCPcopy Index your code
hub / github.com/shipshapecode/tether / initAnim

Function initAnim

examples/dolls/dolls.js:56–83  ·  view source on GitHub ↗
(el)

Source from the content-addressed store, hash-verified

54});
55
56function initAnim(el){
57 var start = performance.now()
58 var last = 0;
59 var lastTop = 0;
60 var tick = function(){
61 var diff = performance.now() - last;
62
63 if (!last || diff > 50){
64 last = performance.now();
65
66 var nextTop = 50 * Math.sin((last - start) / 1000);
67
68 var curTop = parseFloat(el.style.top || 0);
69 var topChange = nextTop - lastTop;
70 lastTop = nextTop;
71
72 var top = curTop + topChange;
73
74 el.style.top = top + 'px';
75
76 Tether.position();
77 }
78
79 requestAnimationFrame(tick);
80 };
81
82 tick();
83}

Callers 1

dolls.jsFile · 0.85

Calls 1

tickFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…