智慧水务管理系统 - 精河县供水工程综合管理平台

tween.esm.js 42KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386
  1. /**
  2. * The Ease class provides a collection of easing functions for use with tween.js.
  3. */
  4. var Easing = Object.freeze({
  5. Linear: Object.freeze({
  6. None: function (amount) {
  7. return amount;
  8. },
  9. In: function (amount) {
  10. return amount;
  11. },
  12. Out: function (amount) {
  13. return amount;
  14. },
  15. InOut: function (amount) {
  16. return amount;
  17. },
  18. }),
  19. Quadratic: Object.freeze({
  20. In: function (amount) {
  21. return amount * amount;
  22. },
  23. Out: function (amount) {
  24. return amount * (2 - amount);
  25. },
  26. InOut: function (amount) {
  27. if ((amount *= 2) < 1) {
  28. return 0.5 * amount * amount;
  29. }
  30. return -0.5 * (--amount * (amount - 2) - 1);
  31. },
  32. }),
  33. Cubic: Object.freeze({
  34. In: function (amount) {
  35. return amount * amount * amount;
  36. },
  37. Out: function (amount) {
  38. return --amount * amount * amount + 1;
  39. },
  40. InOut: function (amount) {
  41. if ((amount *= 2) < 1) {
  42. return 0.5 * amount * amount * amount;
  43. }
  44. return 0.5 * ((amount -= 2) * amount * amount + 2);
  45. },
  46. }),
  47. Quartic: Object.freeze({
  48. In: function (amount) {
  49. return amount * amount * amount * amount;
  50. },
  51. Out: function (amount) {
  52. return 1 - --amount * amount * amount * amount;
  53. },
  54. InOut: function (amount) {
  55. if ((amount *= 2) < 1) {
  56. return 0.5 * amount * amount * amount * amount;
  57. }
  58. return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
  59. },
  60. }),
  61. Quintic: Object.freeze({
  62. In: function (amount) {
  63. return amount * amount * amount * amount * amount;
  64. },
  65. Out: function (amount) {
  66. return --amount * amount * amount * amount * amount + 1;
  67. },
  68. InOut: function (amount) {
  69. if ((amount *= 2) < 1) {
  70. return 0.5 * amount * amount * amount * amount * amount;
  71. }
  72. return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
  73. },
  74. }),
  75. Sinusoidal: Object.freeze({
  76. In: function (amount) {
  77. return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
  78. },
  79. Out: function (amount) {
  80. return Math.sin((amount * Math.PI) / 2);
  81. },
  82. InOut: function (amount) {
  83. return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
  84. },
  85. }),
  86. Exponential: Object.freeze({
  87. In: function (amount) {
  88. return amount === 0 ? 0 : Math.pow(1024, amount - 1);
  89. },
  90. Out: function (amount) {
  91. return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);
  92. },
  93. InOut: function (amount) {
  94. if (amount === 0) {
  95. return 0;
  96. }
  97. if (amount === 1) {
  98. return 1;
  99. }
  100. if ((amount *= 2) < 1) {
  101. return 0.5 * Math.pow(1024, amount - 1);
  102. }
  103. return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
  104. },
  105. }),
  106. Circular: Object.freeze({
  107. In: function (amount) {
  108. return 1 - Math.sqrt(1 - amount * amount);
  109. },
  110. Out: function (amount) {
  111. return Math.sqrt(1 - --amount * amount);
  112. },
  113. InOut: function (amount) {
  114. if ((amount *= 2) < 1) {
  115. return -0.5 * (Math.sqrt(1 - amount * amount) - 1);
  116. }
  117. return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
  118. },
  119. }),
  120. Elastic: Object.freeze({
  121. In: function (amount) {
  122. if (amount === 0) {
  123. return 0;
  124. }
  125. if (amount === 1) {
  126. return 1;
  127. }
  128. return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
  129. },
  130. Out: function (amount) {
  131. if (amount === 0) {
  132. return 0;
  133. }
  134. if (amount === 1) {
  135. return 1;
  136. }
  137. return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1;
  138. },
  139. InOut: function (amount) {
  140. if (amount === 0) {
  141. return 0;
  142. }
  143. if (amount === 1) {
  144. return 1;
  145. }
  146. amount *= 2;
  147. if (amount < 1) {
  148. return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
  149. }
  150. return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
  151. },
  152. }),
  153. Back: Object.freeze({
  154. In: function (amount) {
  155. var s = 1.70158;
  156. return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
  157. },
  158. Out: function (amount) {
  159. var s = 1.70158;
  160. return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
  161. },
  162. InOut: function (amount) {
  163. var s = 1.70158 * 1.525;
  164. if ((amount *= 2) < 1) {
  165. return 0.5 * (amount * amount * ((s + 1) * amount - s));
  166. }
  167. return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
  168. },
  169. }),
  170. Bounce: Object.freeze({
  171. In: function (amount) {
  172. return 1 - Easing.Bounce.Out(1 - amount);
  173. },
  174. Out: function (amount) {
  175. if (amount < 1 / 2.75) {
  176. return 7.5625 * amount * amount;
  177. }
  178. else if (amount < 2 / 2.75) {
  179. return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;
  180. }
  181. else if (amount < 2.5 / 2.75) {
  182. return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;
  183. }
  184. else {
  185. return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;
  186. }
  187. },
  188. InOut: function (amount) {
  189. if (amount < 0.5) {
  190. return Easing.Bounce.In(amount * 2) * 0.5;
  191. }
  192. return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
  193. },
  194. }),
  195. generatePow: function (power) {
  196. if (power === void 0) { power = 4; }
  197. power = power < Number.EPSILON ? Number.EPSILON : power;
  198. power = power > 10000 ? 10000 : power;
  199. return {
  200. In: function (amount) {
  201. return Math.pow(amount, power);
  202. },
  203. Out: function (amount) {
  204. return 1 - Math.pow((1 - amount), power);
  205. },
  206. InOut: function (amount) {
  207. if (amount < 0.5) {
  208. return Math.pow((amount * 2), power) / 2;
  209. }
  210. return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;
  211. },
  212. };
  213. },
  214. });
  215. var now = function () { return performance.now(); };
  216. /**
  217. * Controlling groups of tweens
  218. *
  219. * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
  220. * In these cases, you may want to create your own smaller groups of tween
  221. */
  222. var Group = /** @class */ (function () {
  223. function Group() {
  224. var tweens = [];
  225. for (var _i = 0; _i < arguments.length; _i++) {
  226. tweens[_i] = arguments[_i];
  227. }
  228. this._tweens = {};
  229. this._tweensAddedDuringUpdate = {};
  230. this.add.apply(this, tweens);
  231. }
  232. Group.prototype.getAll = function () {
  233. var _this = this;
  234. return Object.keys(this._tweens).map(function (tweenId) { return _this._tweens[tweenId]; });
  235. };
  236. Group.prototype.removeAll = function () {
  237. this._tweens = {};
  238. };
  239. Group.prototype.add = function () {
  240. var _a;
  241. var tweens = [];
  242. for (var _i = 0; _i < arguments.length; _i++) {
  243. tweens[_i] = arguments[_i];
  244. }
  245. for (var _b = 0, tweens_1 = tweens; _b < tweens_1.length; _b++) {
  246. var tween = tweens_1[_b];
  247. // Remove from any other group first, a tween can only be in one group at a time.
  248. // @ts-expect-error library internal access
  249. (_a = tween._group) === null || _a === void 0 ? void 0 : _a.remove(tween);
  250. // @ts-expect-error library internal access
  251. tween._group = this;
  252. this._tweens[tween.getId()] = tween;
  253. this._tweensAddedDuringUpdate[tween.getId()] = tween;
  254. }
  255. };
  256. Group.prototype.remove = function () {
  257. var tweens = [];
  258. for (var _i = 0; _i < arguments.length; _i++) {
  259. tweens[_i] = arguments[_i];
  260. }
  261. for (var _a = 0, tweens_2 = tweens; _a < tweens_2.length; _a++) {
  262. var tween = tweens_2[_a];
  263. // @ts-expect-error library internal access
  264. tween._group = undefined;
  265. delete this._tweens[tween.getId()];
  266. delete this._tweensAddedDuringUpdate[tween.getId()];
  267. }
  268. };
  269. /** Return true if all tweens in the group are not paused or playing. */
  270. Group.prototype.allStopped = function () {
  271. return this.getAll().every(function (tween) { return !tween.isPlaying(); });
  272. };
  273. Group.prototype.update = function (time, preserve) {
  274. if (time === void 0) { time = now(); }
  275. if (preserve === void 0) { preserve = true; }
  276. var tweenIds = Object.keys(this._tweens);
  277. if (tweenIds.length === 0)
  278. return;
  279. // Tweens are updated in "batches". If you add a new tween during an
  280. // update, then the new tween will be updated in the next batch.
  281. // If you remove a tween during an update, it may or may not be updated.
  282. // However, if the removed tween was added during the current batch,
  283. // then it will not be updated.
  284. while (tweenIds.length > 0) {
  285. this._tweensAddedDuringUpdate = {};
  286. for (var i = 0; i < tweenIds.length; i++) {
  287. var tween = this._tweens[tweenIds[i]];
  288. var autoStart = !preserve;
  289. if (tween && tween.update(time, autoStart) === false && !preserve)
  290. this.remove(tween);
  291. }
  292. tweenIds = Object.keys(this._tweensAddedDuringUpdate);
  293. }
  294. };
  295. return Group;
  296. }());
  297. /**
  298. *
  299. */
  300. var Interpolation = {
  301. Linear: function (v, k) {
  302. var m = v.length - 1;
  303. var f = m * k;
  304. var i = Math.floor(f);
  305. var fn = Interpolation.Utils.Linear;
  306. if (k < 0) {
  307. return fn(v[0], v[1], f);
  308. }
  309. if (k > 1) {
  310. return fn(v[m], v[m - 1], m - f);
  311. }
  312. return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);
  313. },
  314. Bezier: function (v, k) {
  315. var b = 0;
  316. var n = v.length - 1;
  317. var pw = Math.pow;
  318. var bn = Interpolation.Utils.Bernstein;
  319. for (var i = 0; i <= n; i++) {
  320. b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
  321. }
  322. return b;
  323. },
  324. CatmullRom: function (v, k) {
  325. var m = v.length - 1;
  326. var f = m * k;
  327. var i = Math.floor(f);
  328. var fn = Interpolation.Utils.CatmullRom;
  329. if (v[0] === v[m]) {
  330. if (k < 0) {
  331. i = Math.floor((f = m * (1 + k)));
  332. }
  333. return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
  334. }
  335. else {
  336. if (k < 0) {
  337. return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);
  338. }
  339. if (k > 1) {
  340. return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
  341. }
  342. return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i);
  343. }
  344. },
  345. Utils: {
  346. Linear: function (p0, p1, t) {
  347. return (p1 - p0) * t + p0;
  348. },
  349. Bernstein: function (n, i) {
  350. var fc = Interpolation.Utils.Factorial;
  351. return fc(n) / fc(i) / fc(n - i);
  352. },
  353. Factorial: (function () {
  354. var a = [1];
  355. return function (n) {
  356. var s = 1;
  357. if (a[n]) {
  358. return a[n];
  359. }
  360. for (var i = n; i > 1; i--) {
  361. s *= i;
  362. }
  363. a[n] = s;
  364. return s;
  365. };
  366. })(),
  367. CatmullRom: function (p0, p1, p2, p3, t) {
  368. var v0 = (p2 - p0) * 0.5;
  369. var v1 = (p3 - p1) * 0.5;
  370. var t2 = t * t;
  371. var t3 = t * t2;
  372. return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
  373. },
  374. },
  375. };
  376. /**
  377. * Utils
  378. */
  379. var Sequence = /** @class */ (function () {
  380. function Sequence() {
  381. }
  382. Sequence.nextId = function () {
  383. return Sequence._nextId++;
  384. };
  385. Sequence._nextId = 0;
  386. return Sequence;
  387. }());
  388. var mainGroup = new Group();
  389. /**
  390. * Tween.js - Licensed under the MIT license
  391. * https://github.com/tweenjs/tween.js
  392. * ----------------------------------------------
  393. *
  394. * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
  395. * Thank you all, you're awesome!
  396. */
  397. var Tween = /** @class */ (function () {
  398. function Tween(object, group) {
  399. this._isPaused = false;
  400. this._pauseStart = 0;
  401. this._valuesStart = {};
  402. this._valuesEnd = {};
  403. this._valuesStartRepeat = {};
  404. this._duration = 1000;
  405. this._isDynamic = false;
  406. this._initialRepeat = 0;
  407. this._repeat = 0;
  408. this._yoyo = false;
  409. this._isPlaying = false;
  410. this._reversed = false;
  411. this._delayTime = 0;
  412. this._startTime = 0;
  413. this._easingFunction = Easing.Linear.None;
  414. this._interpolationFunction = Interpolation.Linear;
  415. // eslint-disable-next-line
  416. this._chainedTweens = [];
  417. this._onStartCallbackFired = false;
  418. this._onEveryStartCallbackFired = false;
  419. this._id = Sequence.nextId();
  420. this._isChainStopped = false;
  421. this._propertiesAreSetUp = false;
  422. this._goToEnd = false;
  423. this._object = object;
  424. if (typeof group === 'object') {
  425. this._group = group;
  426. group.add(this);
  427. }
  428. // Use "true" to restore old behavior (will be removed in future release).
  429. else if (group === true) {
  430. this._group = mainGroup;
  431. mainGroup.add(this);
  432. }
  433. }
  434. Tween.prototype.getId = function () {
  435. return this._id;
  436. };
  437. Tween.prototype.isPlaying = function () {
  438. return this._isPlaying;
  439. };
  440. Tween.prototype.isPaused = function () {
  441. return this._isPaused;
  442. };
  443. Tween.prototype.getDuration = function () {
  444. return this._duration;
  445. };
  446. Tween.prototype.to = function (target, duration) {
  447. if (duration === void 0) { duration = 1000; }
  448. if (this._isPlaying)
  449. throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
  450. this._valuesEnd = target;
  451. this._propertiesAreSetUp = false;
  452. this._duration = duration < 0 ? 0 : duration;
  453. return this;
  454. };
  455. Tween.prototype.duration = function (duration) {
  456. if (duration === void 0) { duration = 1000; }
  457. this._duration = duration < 0 ? 0 : duration;
  458. return this;
  459. };
  460. Tween.prototype.dynamic = function (dynamic) {
  461. if (dynamic === void 0) { dynamic = false; }
  462. this._isDynamic = dynamic;
  463. return this;
  464. };
  465. Tween.prototype.start = function (time, overrideStartingValues) {
  466. if (time === void 0) { time = now(); }
  467. if (overrideStartingValues === void 0) { overrideStartingValues = false; }
  468. if (this._isPlaying) {
  469. return this;
  470. }
  471. this._repeat = this._initialRepeat;
  472. if (this._reversed) {
  473. // If we were reversed (f.e. using the yoyo feature) then we need to
  474. // flip the tween direction back to forward.
  475. this._reversed = false;
  476. for (var property in this._valuesStartRepeat) {
  477. this._swapEndStartRepeatValues(property);
  478. this._valuesStart[property] = this._valuesStartRepeat[property];
  479. }
  480. }
  481. this._isPlaying = true;
  482. this._isPaused = false;
  483. this._onStartCallbackFired = false;
  484. this._onEveryStartCallbackFired = false;
  485. this._isChainStopped = false;
  486. this._startTime = time;
  487. this._startTime += this._delayTime;
  488. if (!this._propertiesAreSetUp || overrideStartingValues) {
  489. this._propertiesAreSetUp = true;
  490. // If dynamic is not enabled, clone the end values instead of using the passed-in end values.
  491. if (!this._isDynamic) {
  492. var tmp = {};
  493. for (var prop in this._valuesEnd)
  494. tmp[prop] = this._valuesEnd[prop];
  495. this._valuesEnd = tmp;
  496. }
  497. this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
  498. }
  499. return this;
  500. };
  501. Tween.prototype.startFromCurrentValues = function (time) {
  502. return this.start(time, true);
  503. };
  504. Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
  505. for (var property in _valuesEnd) {
  506. var startValue = _object[property];
  507. var startValueIsArray = Array.isArray(startValue);
  508. var propType = startValueIsArray ? 'array' : typeof startValue;
  509. var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]);
  510. // If `to()` specifies a property that doesn't exist in the source object,
  511. // we should not set that property in the object
  512. if (propType === 'undefined' || propType === 'function') {
  513. continue;
  514. }
  515. // Check if an Array was provided as property value
  516. if (isInterpolationList) {
  517. var endValues = _valuesEnd[property];
  518. if (endValues.length === 0) {
  519. continue;
  520. }
  521. // Handle an array of relative values.
  522. // Creates a local copy of the Array with the start value at the front
  523. var temp = [startValue];
  524. for (var i = 0, l = endValues.length; i < l; i += 1) {
  525. var value = this._handleRelativeValue(startValue, endValues[i]);
  526. if (isNaN(value)) {
  527. isInterpolationList = false;
  528. console.warn('Found invalid interpolation list. Skipping.');
  529. break;
  530. }
  531. temp.push(value);
  532. }
  533. if (isInterpolationList) {
  534. // if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
  535. _valuesEnd[property] = temp;
  536. // }
  537. }
  538. }
  539. // handle the deepness of the values
  540. if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
  541. _valuesStart[property] = startValueIsArray ? [] : {};
  542. var nestedObject = startValue;
  543. for (var prop in nestedObject) {
  544. _valuesStart[property][prop] = nestedObject[prop];
  545. }
  546. // TODO? repeat nested values? And yoyo? And array values?
  547. _valuesStartRepeat[property] = startValueIsArray ? [] : {};
  548. var endValues = _valuesEnd[property];
  549. // If dynamic is not enabled, clone the end values instead of using the passed-in end values.
  550. if (!this._isDynamic) {
  551. var tmp = {};
  552. for (var prop in endValues)
  553. tmp[prop] = endValues[prop];
  554. _valuesEnd[property] = endValues = tmp;
  555. }
  556. this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
  557. }
  558. else {
  559. // Save the starting value, but only once unless override is requested.
  560. if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
  561. _valuesStart[property] = startValue;
  562. }
  563. if (!startValueIsArray) {
  564. // eslint-disable-next-line
  565. // @ts-ignore FIXME?
  566. _valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings
  567. }
  568. if (isInterpolationList) {
  569. // eslint-disable-next-line
  570. // @ts-ignore FIXME?
  571. _valuesStartRepeat[property] = _valuesEnd[property].slice().reverse();
  572. }
  573. else {
  574. _valuesStartRepeat[property] = _valuesStart[property] || 0;
  575. }
  576. }
  577. }
  578. };
  579. Tween.prototype.stop = function () {
  580. if (!this._isChainStopped) {
  581. this._isChainStopped = true;
  582. this.stopChainedTweens();
  583. }
  584. if (!this._isPlaying) {
  585. return this;
  586. }
  587. this._isPlaying = false;
  588. this._isPaused = false;
  589. if (this._onStopCallback) {
  590. this._onStopCallback(this._object);
  591. }
  592. return this;
  593. };
  594. Tween.prototype.end = function () {
  595. this._goToEnd = true;
  596. this.update(this._startTime + this._duration);
  597. return this;
  598. };
  599. Tween.prototype.pause = function (time) {
  600. if (time === void 0) { time = now(); }
  601. if (this._isPaused || !this._isPlaying) {
  602. return this;
  603. }
  604. this._isPaused = true;
  605. this._pauseStart = time;
  606. return this;
  607. };
  608. Tween.prototype.resume = function (time) {
  609. if (time === void 0) { time = now(); }
  610. if (!this._isPaused || !this._isPlaying) {
  611. return this;
  612. }
  613. this._isPaused = false;
  614. this._startTime += time - this._pauseStart;
  615. this._pauseStart = 0;
  616. return this;
  617. };
  618. Tween.prototype.stopChainedTweens = function () {
  619. for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
  620. this._chainedTweens[i].stop();
  621. }
  622. return this;
  623. };
  624. Tween.prototype.group = function (group) {
  625. if (!group) {
  626. console.warn('tween.group() without args has been removed, use group.add(tween) instead.');
  627. return this;
  628. }
  629. group.add(this);
  630. return this;
  631. };
  632. /**
  633. * Removes the tween from whichever group it is in.
  634. */
  635. Tween.prototype.remove = function () {
  636. var _a;
  637. (_a = this._group) === null || _a === void 0 ? void 0 : _a.remove(this);
  638. return this;
  639. };
  640. Tween.prototype.delay = function (amount) {
  641. if (amount === void 0) { amount = 0; }
  642. this._delayTime = amount;
  643. return this;
  644. };
  645. Tween.prototype.repeat = function (times) {
  646. if (times === void 0) { times = 0; }
  647. this._initialRepeat = times;
  648. this._repeat = times;
  649. return this;
  650. };
  651. Tween.prototype.repeatDelay = function (amount) {
  652. this._repeatDelayTime = amount;
  653. return this;
  654. };
  655. Tween.prototype.yoyo = function (yoyo) {
  656. if (yoyo === void 0) { yoyo = false; }
  657. this._yoyo = yoyo;
  658. return this;
  659. };
  660. Tween.prototype.easing = function (easingFunction) {
  661. if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
  662. this._easingFunction = easingFunction;
  663. return this;
  664. };
  665. Tween.prototype.interpolation = function (interpolationFunction) {
  666. if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
  667. this._interpolationFunction = interpolationFunction;
  668. return this;
  669. };
  670. // eslint-disable-next-line
  671. Tween.prototype.chain = function () {
  672. var tweens = [];
  673. for (var _i = 0; _i < arguments.length; _i++) {
  674. tweens[_i] = arguments[_i];
  675. }
  676. this._chainedTweens = tweens;
  677. return this;
  678. };
  679. Tween.prototype.onStart = function (callback) {
  680. this._onStartCallback = callback;
  681. return this;
  682. };
  683. Tween.prototype.onEveryStart = function (callback) {
  684. this._onEveryStartCallback = callback;
  685. return this;
  686. };
  687. Tween.prototype.onUpdate = function (callback) {
  688. this._onUpdateCallback = callback;
  689. return this;
  690. };
  691. Tween.prototype.onRepeat = function (callback) {
  692. this._onRepeatCallback = callback;
  693. return this;
  694. };
  695. Tween.prototype.onComplete = function (callback) {
  696. this._onCompleteCallback = callback;
  697. return this;
  698. };
  699. Tween.prototype.onStop = function (callback) {
  700. this._onStopCallback = callback;
  701. return this;
  702. };
  703. /**
  704. * @returns true if the tween is still playing after the update, false
  705. * otherwise (calling update on a paused tween still returns true because
  706. * it is still playing, just paused).
  707. *
  708. * @param autoStart - When true, calling update will implicitly call start()
  709. * as well. Note, if you stop() or end() the tween, but are still calling
  710. * update(), it will start again!
  711. */
  712. Tween.prototype.update = function (time, autoStart) {
  713. var _this = this;
  714. var _a;
  715. if (time === void 0) { time = now(); }
  716. if (autoStart === void 0) { autoStart = Tween.autoStartOnUpdate; }
  717. if (this._isPaused)
  718. return true;
  719. var property;
  720. if (!this._goToEnd && !this._isPlaying) {
  721. if (autoStart)
  722. this.start(time, true);
  723. else
  724. return false;
  725. }
  726. this._goToEnd = false;
  727. if (time < this._startTime) {
  728. return true;
  729. }
  730. if (this._onStartCallbackFired === false) {
  731. if (this._onStartCallback) {
  732. this._onStartCallback(this._object);
  733. }
  734. this._onStartCallbackFired = true;
  735. }
  736. if (this._onEveryStartCallbackFired === false) {
  737. if (this._onEveryStartCallback) {
  738. this._onEveryStartCallback(this._object);
  739. }
  740. this._onEveryStartCallbackFired = true;
  741. }
  742. var elapsedTime = time - this._startTime;
  743. var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
  744. var totalTime = this._duration + this._repeat * durationAndDelay;
  745. var calculateElapsedPortion = function () {
  746. if (_this._duration === 0)
  747. return 1;
  748. if (elapsedTime > totalTime) {
  749. return 1;
  750. }
  751. var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
  752. var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
  753. // TODO use %?
  754. // const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
  755. var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
  756. if (portion === 0 && elapsedTime === _this._duration) {
  757. return 1;
  758. }
  759. return portion;
  760. };
  761. var elapsed = calculateElapsedPortion();
  762. var value = this._easingFunction(elapsed);
  763. // properties transformations
  764. this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
  765. if (this._onUpdateCallback) {
  766. this._onUpdateCallback(this._object, elapsed);
  767. }
  768. if (this._duration === 0 || elapsedTime >= this._duration) {
  769. if (this._repeat > 0) {
  770. var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
  771. if (isFinite(this._repeat)) {
  772. this._repeat -= completeCount;
  773. }
  774. // Reassign starting values, restart by making startTime = now
  775. for (property in this._valuesStartRepeat) {
  776. if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {
  777. this._valuesStartRepeat[property] =
  778. // eslint-disable-next-line
  779. // @ts-ignore FIXME?
  780. this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
  781. }
  782. if (this._yoyo) {
  783. this._swapEndStartRepeatValues(property);
  784. }
  785. this._valuesStart[property] = this._valuesStartRepeat[property];
  786. }
  787. if (this._yoyo) {
  788. this._reversed = !this._reversed;
  789. }
  790. this._startTime += durationAndDelay * completeCount;
  791. if (this._onRepeatCallback) {
  792. this._onRepeatCallback(this._object);
  793. }
  794. this._onEveryStartCallbackFired = false;
  795. return true;
  796. }
  797. else {
  798. if (this._onCompleteCallback) {
  799. this._onCompleteCallback(this._object);
  800. }
  801. for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
  802. // Make the chained tweens start exactly at the time they should,
  803. // even if the `update()` method was called way past the duration of the tween
  804. this._chainedTweens[i].start(this._startTime + this._duration, false);
  805. }
  806. this._isPlaying = false;
  807. return false;
  808. }
  809. }
  810. return true;
  811. };
  812. Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {
  813. for (var property in _valuesEnd) {
  814. // Don't update properties that do not exist in the source object
  815. if (_valuesStart[property] === undefined) {
  816. continue;
  817. }
  818. var start = _valuesStart[property] || 0;
  819. var end = _valuesEnd[property];
  820. var startIsArray = Array.isArray(_object[property]);
  821. var endIsArray = Array.isArray(end);
  822. var isInterpolationList = !startIsArray && endIsArray;
  823. if (isInterpolationList) {
  824. _object[property] = this._interpolationFunction(end, value);
  825. }
  826. else if (typeof end === 'object' && end) {
  827. // eslint-disable-next-line
  828. // @ts-ignore FIXME?
  829. this._updateProperties(_object[property], start, end, value);
  830. }
  831. else {
  832. // Parses relative end values with start as base (e.g.: +10, -3)
  833. end = this._handleRelativeValue(start, end);
  834. // Protect against non numeric properties.
  835. if (typeof end === 'number') {
  836. // eslint-disable-next-line
  837. // @ts-ignore FIXME?
  838. _object[property] = start + (end - start) * value;
  839. }
  840. }
  841. }
  842. };
  843. Tween.prototype._handleRelativeValue = function (start, end) {
  844. if (typeof end !== 'string') {
  845. return end;
  846. }
  847. if (end.charAt(0) === '+' || end.charAt(0) === '-') {
  848. return start + parseFloat(end);
  849. }
  850. return parseFloat(end);
  851. };
  852. Tween.prototype._swapEndStartRepeatValues = function (property) {
  853. var tmp = this._valuesStartRepeat[property];
  854. var endValue = this._valuesEnd[property];
  855. if (typeof endValue === 'string') {
  856. this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);
  857. }
  858. else {
  859. this._valuesStartRepeat[property] = this._valuesEnd[property];
  860. }
  861. this._valuesEnd[property] = tmp;
  862. };
  863. Tween.autoStartOnUpdate = false;
  864. return Tween;
  865. }());
  866. var VERSION = '25.0.0';
  867. /**
  868. * Tween.js - Licensed under the MIT license
  869. * https://github.com/tweenjs/tween.js
  870. * ----------------------------------------------
  871. *
  872. * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
  873. * Thank you all, you're awesome!
  874. */
  875. var nextId = Sequence.nextId;
  876. /**
  877. * Controlling groups of tweens
  878. *
  879. * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
  880. * In these cases, you may want to create your own smaller groups of tweens.
  881. */
  882. var TWEEN = mainGroup;
  883. // This is the best way to export things in a way that's compatible with both ES
  884. // Modules and CommonJS, without build hacks, and so as not to break the
  885. // existing API.
  886. // https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
  887. /**
  888. * @deprecated The global TWEEN Group will be removed in a following major
  889. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  890. * group.
  891. *
  892. * Old code:
  893. *
  894. * ```js
  895. * import * as TWEEN from '@tweenjs/tween.js'
  896. *
  897. * //...
  898. *
  899. * const tween = new TWEEN.Tween(obj)
  900. * const tween2 = new TWEEN.Tween(obj2)
  901. *
  902. * //...
  903. *
  904. * requestAnimationFrame(function loop(time) {
  905. * TWEEN.update(time)
  906. * requestAnimationFrame(loop)
  907. * })
  908. * ```
  909. *
  910. * New code:
  911. *
  912. * ```js
  913. * import {Tween, Group} from '@tweenjs/tween.js'
  914. *
  915. * //...
  916. *
  917. * const tween = new Tween(obj)
  918. * const tween2 = new TWEEN.Tween(obj2)
  919. *
  920. * //...
  921. *
  922. * const group = new Group()
  923. * group.add(tween)
  924. * group.add(tween2)
  925. *
  926. * //...
  927. *
  928. * requestAnimationFrame(function loop(time) {
  929. * group.update(time)
  930. * requestAnimationFrame(loop)
  931. * })
  932. * ```
  933. */
  934. var getAll = TWEEN.getAll.bind(TWEEN);
  935. /**
  936. * @deprecated The global TWEEN Group will be removed in a following major
  937. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  938. * group.
  939. *
  940. * Old code:
  941. *
  942. * ```js
  943. * import * as TWEEN from '@tweenjs/tween.js'
  944. *
  945. * //...
  946. *
  947. * const tween = new TWEEN.Tween(obj)
  948. * const tween2 = new TWEEN.Tween(obj2)
  949. *
  950. * //...
  951. *
  952. * requestAnimationFrame(function loop(time) {
  953. * TWEEN.update(time)
  954. * requestAnimationFrame(loop)
  955. * })
  956. * ```
  957. *
  958. * New code:
  959. *
  960. * ```js
  961. * import {Tween, Group} from '@tweenjs/tween.js'
  962. *
  963. * //...
  964. *
  965. * const tween = new Tween(obj)
  966. * const tween2 = new TWEEN.Tween(obj2)
  967. *
  968. * //...
  969. *
  970. * const group = new Group()
  971. * group.add(tween)
  972. * group.add(tween2)
  973. *
  974. * //...
  975. *
  976. * requestAnimationFrame(function loop(time) {
  977. * group.update(time)
  978. * requestAnimationFrame(loop)
  979. * })
  980. * ```
  981. */
  982. var removeAll = TWEEN.removeAll.bind(TWEEN);
  983. /**
  984. * @deprecated The global TWEEN Group will be removed in a following major
  985. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  986. * group.
  987. *
  988. * Old code:
  989. *
  990. * ```js
  991. * import * as TWEEN from '@tweenjs/tween.js'
  992. *
  993. * //...
  994. *
  995. * const tween = new TWEEN.Tween(obj)
  996. * const tween2 = new TWEEN.Tween(obj2)
  997. *
  998. * //...
  999. *
  1000. * requestAnimationFrame(function loop(time) {
  1001. * TWEEN.update(time)
  1002. * requestAnimationFrame(loop)
  1003. * })
  1004. * ```
  1005. *
  1006. * New code:
  1007. *
  1008. * ```js
  1009. * import {Tween, Group} from '@tweenjs/tween.js'
  1010. *
  1011. * //...
  1012. *
  1013. * const tween = new Tween(obj)
  1014. * const tween2 = new TWEEN.Tween(obj2)
  1015. *
  1016. * //...
  1017. *
  1018. * const group = new Group()
  1019. * group.add(tween)
  1020. * group.add(tween2)
  1021. *
  1022. * //...
  1023. *
  1024. * requestAnimationFrame(function loop(time) {
  1025. * group.update(time)
  1026. * requestAnimationFrame(loop)
  1027. * })
  1028. * ```
  1029. */
  1030. var add = TWEEN.add.bind(TWEEN);
  1031. /**
  1032. * @deprecated The global TWEEN Group will be removed in a following major
  1033. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  1034. * group.
  1035. *
  1036. * Old code:
  1037. *
  1038. * ```js
  1039. * import * as TWEEN from '@tweenjs/tween.js'
  1040. *
  1041. * //...
  1042. *
  1043. * const tween = new TWEEN.Tween(obj)
  1044. * const tween2 = new TWEEN.Tween(obj2)
  1045. *
  1046. * //...
  1047. *
  1048. * requestAnimationFrame(function loop(time) {
  1049. * TWEEN.update(time)
  1050. * requestAnimationFrame(loop)
  1051. * })
  1052. * ```
  1053. *
  1054. * New code:
  1055. *
  1056. * ```js
  1057. * import {Tween, Group} from '@tweenjs/tween.js'
  1058. *
  1059. * //...
  1060. *
  1061. * const tween = new Tween(obj)
  1062. * const tween2 = new TWEEN.Tween(obj2)
  1063. *
  1064. * //...
  1065. *
  1066. * const group = new Group()
  1067. * group.add(tween)
  1068. * group.add(tween2)
  1069. *
  1070. * //...
  1071. *
  1072. * requestAnimationFrame(function loop(time) {
  1073. * group.update(time)
  1074. * requestAnimationFrame(loop)
  1075. * })
  1076. * ```
  1077. */
  1078. var remove = TWEEN.remove.bind(TWEEN);
  1079. /**
  1080. * @deprecated The global TWEEN Group will be removed in a following major
  1081. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  1082. * group.
  1083. *
  1084. * Old code:
  1085. *
  1086. * ```js
  1087. * import * as TWEEN from '@tweenjs/tween.js'
  1088. *
  1089. * //...
  1090. *
  1091. * const tween = new TWEEN.Tween(obj)
  1092. * const tween2 = new TWEEN.Tween(obj2)
  1093. *
  1094. * //...
  1095. *
  1096. * requestAnimationFrame(function loop(time) {
  1097. * TWEEN.update(time)
  1098. * requestAnimationFrame(loop)
  1099. * })
  1100. * ```
  1101. *
  1102. * New code:
  1103. *
  1104. * ```js
  1105. * import {Tween, Group} from '@tweenjs/tween.js'
  1106. *
  1107. * //...
  1108. *
  1109. * const tween = new Tween(obj)
  1110. * const tween2 = new TWEEN.Tween(obj2)
  1111. *
  1112. * //...
  1113. *
  1114. * const group = new Group()
  1115. * group.add(tween)
  1116. * group.add(tween2)
  1117. *
  1118. * //...
  1119. *
  1120. * requestAnimationFrame(function loop(time) {
  1121. * group.update(time)
  1122. * requestAnimationFrame(loop)
  1123. * })
  1124. * ```
  1125. */
  1126. var update = TWEEN.update.bind(TWEEN);
  1127. var exports = {
  1128. Easing: Easing,
  1129. Group: Group,
  1130. Interpolation: Interpolation,
  1131. now: now,
  1132. Sequence: Sequence,
  1133. nextId: nextId,
  1134. Tween: Tween,
  1135. VERSION: VERSION,
  1136. /**
  1137. * @deprecated The global TWEEN Group will be removed in a following major
  1138. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  1139. * group.
  1140. *
  1141. * Old code:
  1142. *
  1143. * ```js
  1144. * import * as TWEEN from '@tweenjs/tween.js'
  1145. *
  1146. * //...
  1147. *
  1148. * const tween = new TWEEN.Tween(obj)
  1149. * const tween2 = new TWEEN.Tween(obj2)
  1150. *
  1151. * //...
  1152. *
  1153. * requestAnimationFrame(function loop(time) {
  1154. * TWEEN.update(time)
  1155. * requestAnimationFrame(loop)
  1156. * })
  1157. * ```
  1158. *
  1159. * New code:
  1160. *
  1161. * ```js
  1162. * import {Tween, Group} from '@tweenjs/tween.js'
  1163. *
  1164. * //...
  1165. *
  1166. * const tween = new Tween(obj)
  1167. * const tween2 = new TWEEN.Tween(obj2)
  1168. *
  1169. * //...
  1170. *
  1171. * const group = new Group()
  1172. * group.add(tween)
  1173. * group.add(tween2)
  1174. *
  1175. * //...
  1176. *
  1177. * requestAnimationFrame(function loop(time) {
  1178. * group.update(time)
  1179. * requestAnimationFrame(loop)
  1180. * })
  1181. * ```
  1182. */
  1183. getAll: getAll,
  1184. /**
  1185. * @deprecated The global TWEEN Group will be removed in a following major
  1186. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  1187. * group.
  1188. *
  1189. * Old code:
  1190. *
  1191. * ```js
  1192. * import * as TWEEN from '@tweenjs/tween.js'
  1193. *
  1194. * //...
  1195. *
  1196. * const tween = new TWEEN.Tween(obj)
  1197. * const tween2 = new TWEEN.Tween(obj2)
  1198. *
  1199. * //...
  1200. *
  1201. * requestAnimationFrame(function loop(time) {
  1202. * TWEEN.update(time)
  1203. * requestAnimationFrame(loop)
  1204. * })
  1205. * ```
  1206. *
  1207. * New code:
  1208. *
  1209. * ```js
  1210. * import {Tween, Group} from '@tweenjs/tween.js'
  1211. *
  1212. * //...
  1213. *
  1214. * const tween = new Tween(obj)
  1215. * const tween2 = new TWEEN.Tween(obj2)
  1216. *
  1217. * //...
  1218. *
  1219. * const group = new Group()
  1220. * group.add(tween)
  1221. * group.add(tween2)
  1222. *
  1223. * //...
  1224. *
  1225. * requestAnimationFrame(function loop(time) {
  1226. * group.update(time)
  1227. * requestAnimationFrame(loop)
  1228. * })
  1229. * ```
  1230. */
  1231. removeAll: removeAll,
  1232. /**
  1233. * @deprecated The global TWEEN Group will be removed in a following major
  1234. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  1235. * group.
  1236. *
  1237. * Old code:
  1238. *
  1239. * ```js
  1240. * import * as TWEEN from '@tweenjs/tween.js'
  1241. *
  1242. * //...
  1243. *
  1244. * const tween = new TWEEN.Tween(obj)
  1245. * const tween2 = new TWEEN.Tween(obj2)
  1246. *
  1247. * //...
  1248. *
  1249. * requestAnimationFrame(function loop(time) {
  1250. * TWEEN.update(time)
  1251. * requestAnimationFrame(loop)
  1252. * })
  1253. * ```
  1254. *
  1255. * New code:
  1256. *
  1257. * ```js
  1258. * import {Tween, Group} from '@tweenjs/tween.js'
  1259. *
  1260. * //...
  1261. *
  1262. * const tween = new Tween(obj)
  1263. * const tween2 = new TWEEN.Tween(obj2)
  1264. *
  1265. * //...
  1266. *
  1267. * const group = new Group()
  1268. * group.add(tween)
  1269. * group.add(tween2)
  1270. *
  1271. * //...
  1272. *
  1273. * requestAnimationFrame(function loop(time) {
  1274. * group.update(time)
  1275. * requestAnimationFrame(loop)
  1276. * })
  1277. * ```
  1278. */
  1279. add: add,
  1280. /**
  1281. * @deprecated The global TWEEN Group will be removed in a following major
  1282. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  1283. * group.
  1284. *
  1285. * Old code:
  1286. *
  1287. * ```js
  1288. * import * as TWEEN from '@tweenjs/tween.js'
  1289. *
  1290. * //...
  1291. *
  1292. * const tween = new TWEEN.Tween(obj)
  1293. * const tween2 = new TWEEN.Tween(obj2)
  1294. *
  1295. * //...
  1296. *
  1297. * requestAnimationFrame(function loop(time) {
  1298. * TWEEN.update(time)
  1299. * requestAnimationFrame(loop)
  1300. * })
  1301. * ```
  1302. *
  1303. * New code:
  1304. *
  1305. * ```js
  1306. * import {Tween, Group} from '@tweenjs/tween.js'
  1307. *
  1308. * //...
  1309. *
  1310. * const tween = new Tween(obj)
  1311. * const tween2 = new TWEEN.Tween(obj2)
  1312. *
  1313. * //...
  1314. *
  1315. * const group = new Group()
  1316. * group.add(tween)
  1317. * group.add(tween2)
  1318. *
  1319. * //...
  1320. *
  1321. * requestAnimationFrame(function loop(time) {
  1322. * group.update(time)
  1323. * requestAnimationFrame(loop)
  1324. * })
  1325. * ```
  1326. */
  1327. remove: remove,
  1328. /**
  1329. * @deprecated The global TWEEN Group will be removed in a following major
  1330. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  1331. * group.
  1332. *
  1333. * Old code:
  1334. *
  1335. * ```js
  1336. * import * as TWEEN from '@tweenjs/tween.js'
  1337. *
  1338. * //...
  1339. *
  1340. * const tween = new TWEEN.Tween(obj)
  1341. * const tween2 = new TWEEN.Tween(obj2)
  1342. *
  1343. * //...
  1344. *
  1345. * requestAnimationFrame(function loop(time) {
  1346. * TWEEN.update(time)
  1347. * requestAnimationFrame(loop)
  1348. * })
  1349. * ```
  1350. *
  1351. * New code:
  1352. *
  1353. * ```js
  1354. * import {Tween, Group} from '@tweenjs/tween.js'
  1355. *
  1356. * //...
  1357. *
  1358. * const tween = new Tween(obj)
  1359. * const tween2 = new TWEEN.Tween(obj2)
  1360. *
  1361. * //...
  1362. *
  1363. * const group = new Group()
  1364. * group.add(tween)
  1365. * group.add(tween2)
  1366. *
  1367. * //...
  1368. *
  1369. * requestAnimationFrame(function loop(time) {
  1370. * group.update(time)
  1371. * requestAnimationFrame(loop)
  1372. * })
  1373. * ```
  1374. */
  1375. update: update,
  1376. };
  1377. export { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, exports as default, getAll, nextId, now, remove, removeAll, update };