Changeset 0c6b92a for imaps-frontend/node_modules/konva/lib/Tween.js
- Timestamp:
- 12/12/24 17:06:06 (6 weeks ago)
- Branches:
- main
- Children:
- 79a0317
- Parents:
- d565449
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified imaps-frontend/node_modules/konva/lib/Tween.js ¶
rd565449 r0c6b92a 6 6 const Node_1 = require("./Node"); 7 7 const Global_1 = require("./Global"); 8 varblacklist = {8 let blacklist = { 9 9 node: 1, 10 10 duration: 1, … … 32 32 } 33 33 fire(str) { 34 varhandler = this[str];34 const handler = this[str]; 35 35 if (handler) { 36 36 handler(); … … 111 111 } 112 112 onEnterFrame() { 113 vart = this.getTimer() - this._startTime;113 const t = this.getTimer() - this._startTime; 114 114 if (this.state === PLAYING) { 115 115 this.setTime(t); … … 129 129 class Tween { 130 130 constructor(config) { 131 varthat = this, node = config.node, nodeId = node._id, duration, easing = config.easing || exports.Easings.Linear, yoyo = !!config.yoyo, key;131 let that = this, node = config.node, nodeId = node._id, duration, easing = config.easing || exports.Easings.Linear, yoyo = !!config.yoyo, key; 132 132 if (typeof config.duration === 'undefined') { 133 133 duration = 0.3; … … 141 141 this.node = node; 142 142 this._id = idCounter++; 143 varlayers = node.getLayer() ||143 const layers = node.getLayer() || 144 144 (node instanceof Global_1.Konva['Stage'] ? node.getLayers() : null); 145 145 if (!layers) { … … 173 173 } 174 174 _addAttr(key, end) { 175 varnode = this.node, nodeId = node._id, start, diff, tweenId, n, len, trueEnd, trueStart, endRGBA;175 let node = this.node, nodeId = node._id, start, diff, tweenId, n, len, trueEnd, trueStart, endRGBA; 176 176 tweenId = Tween.tweens[nodeId][key]; 177 177 if (tweenId) { … … 198 198 } 199 199 else { 200 varstartRGBA = Util_1.Util.colorToRGBA(start[n]);200 const startRGBA = Util_1.Util.colorToRGBA(start[n]); 201 201 endRGBA = Util_1.Util.colorToRGBA(end[n]); 202 202 start[n] = startRGBA; … … 239 239 } 240 240 _tweenFunc(i) { 241 varnode = this.node, attrs = Tween.attrs[node._id][this._id], key, attr, start, diff, newVal, n, len, end;241 let node = this.node, attrs = Tween.attrs[node._id][this._id], key, attr, start, diff, newVal, n, len, end; 242 242 for (key in attrs) { 243 243 attr = attrs[key]; … … 301 301 }; 302 302 this.tween.onFinish = () => { 303 varnode = this.node;304 varattrs = Tween.attrs[node._id][this._id];303 const node = this.node; 304 const attrs = Tween.attrs[node._id][this._id]; 305 305 if (attrs.points && attrs.points.trueEnd) { 306 306 node.setAttr('points', attrs.points.trueEnd); … … 311 311 }; 312 312 this.tween.onReset = () => { 313 varnode = this.node;314 varattrs = Tween.attrs[node._id][this._id];313 const node = this.node; 314 const attrs = Tween.attrs[node._id][this._id]; 315 315 if (attrs.points && attrs.points.trueStart) { 316 316 node.points(attrs.points.trueStart); … … 351 351 } 352 352 destroy() { 353 varnodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId], key;353 let nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId], key; 354 354 this.pause(); 355 355 for (key in attrs) { … … 363 363 Tween.tweens = {}; 364 364 Node_1.Node.prototype.to = function (params) { 365 varonFinish = params.onFinish;365 const onFinish = params.onFinish; 366 366 params.node = this; 367 367 params.onFinish = function () { … … 371 371 } 372 372 }; 373 vartween = new Tween(params);373 const tween = new Tween(params); 374 374 tween.play(); 375 375 }; 376 376 exports.Easings = { 377 377 BackEaseIn(t, b, c, d) { 378 vars = 1.70158;378 const s = 1.70158; 379 379 return c * (t /= d) * t * ((s + 1) * t - s) + b; 380 380 }, 381 381 BackEaseOut(t, b, c, d) { 382 vars = 1.70158;382 const s = 1.70158; 383 383 return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; 384 384 }, 385 385 BackEaseInOut(t, b, c, d) { 386 vars = 1.70158;386 let s = 1.70158; 387 387 if ((t /= d / 2) < 1) { 388 388 return (c / 2) * (t * t * (((s *= 1.525) + 1) * t - s)) + b; … … 391 391 }, 392 392 ElasticEaseIn(t, b, c, d, a, p) { 393 vars = 0;393 let s = 0; 394 394 if (t === 0) { 395 395 return b; … … 413 413 }, 414 414 ElasticEaseOut(t, b, c, d, a, p) { 415 vars = 0;415 let s = 0; 416 416 if (t === 0) { 417 417 return b; … … 435 435 }, 436 436 ElasticEaseInOut(t, b, c, d, a, p) { 437 vars = 0;437 let s = 0; 438 438 if (t === 0) { 439 439 return b;
Note:
See TracChangeset
for help on using the changeset viewer.