MCPcopy
hub / github.com/chartjs/Chart.js / tick

Method tick

src/core/core.animation.js:76–103  ·  view source on GitHub ↗
(date)

Source from the content-addressed store, hash-verified

74 }
75
76 tick(date) {
77 const elapsed = date - this._start;
78 const duration = this._duration;
79 const prop = this._prop;
80 const from = this._from;
81 const loop = this._loop;
82 const to = this._to;
83 let factor;
84
85 this._active = from !== to && (loop || (elapsed < duration));
86
87 if (!this._active) {
88 this._target[prop] = to;
89 this._notify(true);
90 return;
91 }
92
93 if (elapsed < 0) {
94 this._target[prop] = from;
95 return;
96 }
97
98 factor = (elapsed / duration) % 2;
99 factor = loop && factor > 1 ? 2 - factor : factor;
100 factor = this._easing(Math.min(1, Math.max(0, factor)));
101
102 this._target[prop] = this._fn(from, to, factor);
103 }
104
105 wait() {
106 const promises = this._promises || (this._promises = []);

Callers 3

cancelMethod · 0.95
_updateMethod · 0.80

Calls 1

_notifyMethod · 0.95

Tested by

no test coverage detected