MCPcopy
hub / github.com/greensock/GSAP / resetTo

Method resetTo

src/gsap-core.js:2552–2574  ·  view source on GitHub ↗
(property, value, start, startIsRelative, skipRecursion)

Source from the content-addressed store, hash-verified

2550 }
2551
2552 resetTo(property, value, start, startIsRelative, skipRecursion) {
2553 _tickerActive || _ticker.wake();
2554 this._ts || this.play();
2555 let time = Math.min(this._dur, (this._dp._time - this._start) * this._ts),
2556 ratio;
2557 this._initted || _initTween(this, time);
2558 ratio = this._ease(time / this._dur); // don't just get tween.ratio because it may not have rendered yet.
2559 // possible future addition to allow an object with multiple values to update, like tween.resetTo({x: 100, y: 200}); At this point, it doesn't seem worth the added kb given the fact that most users will likely opt for the convenient gsap.quickTo() way of interacting with this method.
2560 // if (_isObject(property)) { // performance optimization
2561 // for (p in property) {
2562 // if (_updatePropTweens(this, p, property[p], value ? value[p] : null, start, ratio, time)) {
2563 // return this.resetTo(property, value, start, startIsRelative); // if a PropTween wasn't found for the property, it'll get forced with a re-initialization so we need to jump out and start over again.
2564 // }
2565 // }
2566 // } else {
2567 if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time, skipRecursion)) {
2568 return this.resetTo(property, value, start, startIsRelative, 1); // if a PropTween wasn't found for the property, it'll get forced with a re-initialization so we need to jump out and start over again.
2569 }
2570 //}
2571 _alignPlayhead(this, 0);
2572 this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0);
2573 return this.render(0);
2574 }
2575
2576 kill(targets, vars = "all") {
2577 if (!targets && (!vars || vars === "all")) {

Callers 10

ScrollTrigger.jsFile · 0.80
onResizeFunction · 0.80
gsap-core.jsFile · 0.80
funcFunction · 0.80
createEffectFunction · 0.80
onCompleteMethod · 0.80
initMethod · 0.80
onResizeFunction · 0.80
funcFunction · 0.80
createEffectMethod · 0.80

Calls 7

renderMethod · 0.95
wakeMethod · 0.80
playMethod · 0.80
_initTweenFunction · 0.70
_updatePropTweensFunction · 0.70
_alignPlayheadFunction · 0.70
_addLinkedListItemFunction · 0.70

Tested by

no test coverage detected