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

tween.d.ts 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. type EasingFunction = (amount: number) => number;
  2. type EasingFunctionGroup = {
  3. In: EasingFunction;
  4. Out: EasingFunction;
  5. InOut: EasingFunction;
  6. };
  7. /**
  8. * The Ease class provides a collection of easing functions for use with tween.js.
  9. */
  10. declare const Easing: Readonly<{
  11. Linear: Readonly<EasingFunctionGroup & {
  12. None: EasingFunction;
  13. }>;
  14. Quadratic: Readonly<EasingFunctionGroup>;
  15. Cubic: Readonly<EasingFunctionGroup>;
  16. Quartic: Readonly<EasingFunctionGroup>;
  17. Quintic: Readonly<EasingFunctionGroup>;
  18. Sinusoidal: Readonly<EasingFunctionGroup>;
  19. Exponential: Readonly<EasingFunctionGroup>;
  20. Circular: Readonly<EasingFunctionGroup>;
  21. Elastic: Readonly<EasingFunctionGroup>;
  22. Back: Readonly<EasingFunctionGroup>;
  23. Bounce: Readonly<EasingFunctionGroup>;
  24. generatePow(power?: number): EasingFunctionGroup;
  25. }>;
  26. /**
  27. *
  28. */
  29. type InterpolationFunction = (v: number[], k: number) => number;
  30. /**
  31. *
  32. */
  33. declare const Interpolation: {
  34. Linear: (v: number[], k: number) => number;
  35. Bezier: (v: number[], k: number) => number;
  36. CatmullRom: (v: number[], k: number) => number;
  37. Utils: {
  38. Linear: (p0: number, p1: number, t: number) => number;
  39. Bernstein: (n: number, i: number) => number;
  40. Factorial: (n: number) => number;
  41. CatmullRom: (p0: number, p1: number, p2: number, p3: number, t: number) => number;
  42. };
  43. };
  44. /**
  45. * Tween.js - Licensed under the MIT license
  46. * https://github.com/tweenjs/tween.js
  47. * ----------------------------------------------
  48. *
  49. * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
  50. * Thank you all, you're awesome!
  51. */
  52. declare class Tween<T extends UnknownProps = any> {
  53. static autoStartOnUpdate: boolean;
  54. private _isPaused;
  55. private _pauseStart;
  56. private _valuesStart;
  57. private _valuesEnd;
  58. private _valuesStartRepeat;
  59. private _duration;
  60. private _isDynamic;
  61. private _initialRepeat;
  62. private _repeat;
  63. private _repeatDelayTime?;
  64. private _yoyo;
  65. private _isPlaying;
  66. private _reversed;
  67. private _delayTime;
  68. private _startTime;
  69. private _easingFunction;
  70. private _interpolationFunction;
  71. private _chainedTweens;
  72. private _onStartCallback?;
  73. private _onStartCallbackFired;
  74. private _onEveryStartCallback?;
  75. private _onEveryStartCallbackFired;
  76. private _onUpdateCallback?;
  77. private _onRepeatCallback?;
  78. private _onCompleteCallback?;
  79. private _onStopCallback?;
  80. private _id;
  81. private _isChainStopped;
  82. private _propertiesAreSetUp;
  83. private _object;
  84. private _group?;
  85. /**
  86. * @param object - The object whose properties this Tween will animate.
  87. * @param group - The object whose properties this Tween will animate.
  88. */
  89. constructor(object: T, group?: Group);
  90. /**
  91. * @deprecated The group parameter is now deprecated, instead use `new
  92. * Tween(object)` then `group.add(tween)` to add a tween to a group. Use
  93. * `new Tween(object, true)` to restore the old behavior for now, but this
  94. * will be removed in the future.
  95. */
  96. constructor(object: T, group: true);
  97. getId(): number;
  98. isPlaying(): boolean;
  99. isPaused(): boolean;
  100. getDuration(): number;
  101. to(target: UnknownProps, duration?: number): this;
  102. duration(duration?: number): this;
  103. dynamic(dynamic?: boolean): this;
  104. start(time?: number, overrideStartingValues?: boolean): this;
  105. startFromCurrentValues(time?: number): this;
  106. private _setupProperties;
  107. stop(): this;
  108. end(): this;
  109. pause(time?: number): this;
  110. resume(time?: number): this;
  111. stopChainedTweens(): this;
  112. /**
  113. * Removes the tween from the current group it is in, if any, then adds the
  114. * tween to the specified `group`.
  115. */
  116. group(group: Group): this;
  117. /**
  118. * @deprecated The argless call signature has been removed. Use
  119. * `tween.group(group)` or `group.add(tween)`, instead.
  120. */
  121. group(): this;
  122. /**
  123. * Removes the tween from whichever group it is in.
  124. */
  125. remove(): this;
  126. delay(amount?: number): this;
  127. repeat(times?: number): this;
  128. repeatDelay(amount?: number): this;
  129. yoyo(yoyo?: boolean): this;
  130. easing(easingFunction?: EasingFunction): this;
  131. interpolation(interpolationFunction?: InterpolationFunction): this;
  132. chain(...tweens: Array<Tween<any>>): this;
  133. onStart(callback?: (object: T) => void): this;
  134. onEveryStart(callback?: (object: T) => void): this;
  135. onUpdate(callback?: (object: T, elapsed: number) => void): this;
  136. onRepeat(callback?: (object: T) => void): this;
  137. onComplete(callback?: (object: T) => void): this;
  138. onStop(callback?: (object: T) => void): this;
  139. private _goToEnd;
  140. /**
  141. * @returns true if the tween is still playing after the update, false
  142. * otherwise (calling update on a paused tween still returns true because
  143. * it is still playing, just paused).
  144. *
  145. * @param autoStart - When true, calling update will implicitly call start()
  146. * as well. Note, if you stop() or end() the tween, but are still calling
  147. * update(), it will start again!
  148. */
  149. update(time?: number, autoStart?: boolean): boolean;
  150. private _updateProperties;
  151. private _handleRelativeValue;
  152. private _swapEndStartRepeatValues;
  153. }
  154. type UnknownProps = Record<string, any>;
  155. /**
  156. * Controlling groups of tweens
  157. *
  158. * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
  159. * In these cases, you may want to create your own smaller groups of tween
  160. */
  161. declare class Group {
  162. private _tweens;
  163. private _tweensAddedDuringUpdate;
  164. constructor(...tweens: Tween[]);
  165. getAll(): Array<Tween>;
  166. removeAll(): void;
  167. add(...tweens: Tween[]): void;
  168. remove(...tweens: Tween[]): void;
  169. /** Return true if all tweens in the group are not paused or playing. */
  170. allStopped(): boolean;
  171. update(time?: number): void;
  172. /**
  173. * @deprecated The `preserve` parameter is now defaulted to `true` and will
  174. * be removed in a future major release, at which point all tweens of a
  175. * group will always be preserved when calling update. To migrate, always
  176. * use `group.add(tween)` or `group.remove(tween)` to manually add or remove
  177. * tweens, and do not rely on tweens being automatically added or removed.
  178. */
  179. update(time?: number, preserve?: boolean): void;
  180. }
  181. declare const now: () => number;
  182. /**
  183. * Utils
  184. */
  185. declare class Sequence {
  186. private static _nextId;
  187. static nextId(): number;
  188. }
  189. declare const VERSION = "25.0.0";
  190. declare const nextId: typeof Sequence.nextId;
  191. /**
  192. * @deprecated The global TWEEN Group will be removed in a following major
  193. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  194. * group.
  195. *
  196. * Old code:
  197. *
  198. * ```js
  199. * import * as TWEEN from '@tweenjs/tween.js'
  200. *
  201. * //...
  202. *
  203. * const tween = new TWEEN.Tween(obj)
  204. * const tween2 = new TWEEN.Tween(obj2)
  205. *
  206. * //...
  207. *
  208. * requestAnimationFrame(function loop(time) {
  209. * TWEEN.update(time)
  210. * requestAnimationFrame(loop)
  211. * })
  212. * ```
  213. *
  214. * New code:
  215. *
  216. * ```js
  217. * import {Tween, Group} from '@tweenjs/tween.js'
  218. *
  219. * //...
  220. *
  221. * const tween = new Tween(obj)
  222. * const tween2 = new TWEEN.Tween(obj2)
  223. *
  224. * //...
  225. *
  226. * const group = new Group()
  227. * group.add(tween)
  228. * group.add(tween2)
  229. *
  230. * //...
  231. *
  232. * requestAnimationFrame(function loop(time) {
  233. * group.update(time)
  234. * requestAnimationFrame(loop)
  235. * })
  236. * ```
  237. */
  238. declare const getAll: () => Tween<any>[];
  239. /**
  240. * @deprecated The global TWEEN Group will be removed in a following major
  241. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  242. * group.
  243. *
  244. * Old code:
  245. *
  246. * ```js
  247. * import * as TWEEN from '@tweenjs/tween.js'
  248. *
  249. * //...
  250. *
  251. * const tween = new TWEEN.Tween(obj)
  252. * const tween2 = new TWEEN.Tween(obj2)
  253. *
  254. * //...
  255. *
  256. * requestAnimationFrame(function loop(time) {
  257. * TWEEN.update(time)
  258. * requestAnimationFrame(loop)
  259. * })
  260. * ```
  261. *
  262. * New code:
  263. *
  264. * ```js
  265. * import {Tween, Group} from '@tweenjs/tween.js'
  266. *
  267. * //...
  268. *
  269. * const tween = new Tween(obj)
  270. * const tween2 = new TWEEN.Tween(obj2)
  271. *
  272. * //...
  273. *
  274. * const group = new Group()
  275. * group.add(tween)
  276. * group.add(tween2)
  277. *
  278. * //...
  279. *
  280. * requestAnimationFrame(function loop(time) {
  281. * group.update(time)
  282. * requestAnimationFrame(loop)
  283. * })
  284. * ```
  285. */
  286. declare const removeAll: () => void;
  287. /**
  288. * @deprecated The global TWEEN Group will be removed in a following major
  289. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  290. * group.
  291. *
  292. * Old code:
  293. *
  294. * ```js
  295. * import * as TWEEN from '@tweenjs/tween.js'
  296. *
  297. * //...
  298. *
  299. * const tween = new TWEEN.Tween(obj)
  300. * const tween2 = new TWEEN.Tween(obj2)
  301. *
  302. * //...
  303. *
  304. * requestAnimationFrame(function loop(time) {
  305. * TWEEN.update(time)
  306. * requestAnimationFrame(loop)
  307. * })
  308. * ```
  309. *
  310. * New code:
  311. *
  312. * ```js
  313. * import {Tween, Group} from '@tweenjs/tween.js'
  314. *
  315. * //...
  316. *
  317. * const tween = new Tween(obj)
  318. * const tween2 = new TWEEN.Tween(obj2)
  319. *
  320. * //...
  321. *
  322. * const group = new Group()
  323. * group.add(tween)
  324. * group.add(tween2)
  325. *
  326. * //...
  327. *
  328. * requestAnimationFrame(function loop(time) {
  329. * group.update(time)
  330. * requestAnimationFrame(loop)
  331. * })
  332. * ```
  333. */
  334. declare const add: (...tweens: Tween<any>[]) => void;
  335. /**
  336. * @deprecated The global TWEEN Group will be removed in a following major
  337. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  338. * group.
  339. *
  340. * Old code:
  341. *
  342. * ```js
  343. * import * as TWEEN from '@tweenjs/tween.js'
  344. *
  345. * //...
  346. *
  347. * const tween = new TWEEN.Tween(obj)
  348. * const tween2 = new TWEEN.Tween(obj2)
  349. *
  350. * //...
  351. *
  352. * requestAnimationFrame(function loop(time) {
  353. * TWEEN.update(time)
  354. * requestAnimationFrame(loop)
  355. * })
  356. * ```
  357. *
  358. * New code:
  359. *
  360. * ```js
  361. * import {Tween, Group} from '@tweenjs/tween.js'
  362. *
  363. * //...
  364. *
  365. * const tween = new Tween(obj)
  366. * const tween2 = new TWEEN.Tween(obj2)
  367. *
  368. * //...
  369. *
  370. * const group = new Group()
  371. * group.add(tween)
  372. * group.add(tween2)
  373. *
  374. * //...
  375. *
  376. * requestAnimationFrame(function loop(time) {
  377. * group.update(time)
  378. * requestAnimationFrame(loop)
  379. * })
  380. * ```
  381. */
  382. declare const remove: (...tweens: Tween<any>[]) => void;
  383. /**
  384. * @deprecated The global TWEEN Group will be removed in a following major
  385. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  386. * group.
  387. *
  388. * Old code:
  389. *
  390. * ```js
  391. * import * as TWEEN from '@tweenjs/tween.js'
  392. *
  393. * //...
  394. *
  395. * const tween = new TWEEN.Tween(obj)
  396. * const tween2 = new TWEEN.Tween(obj2)
  397. *
  398. * //...
  399. *
  400. * requestAnimationFrame(function loop(time) {
  401. * TWEEN.update(time)
  402. * requestAnimationFrame(loop)
  403. * })
  404. * ```
  405. *
  406. * New code:
  407. *
  408. * ```js
  409. * import {Tween, Group} from '@tweenjs/tween.js'
  410. *
  411. * //...
  412. *
  413. * const tween = new Tween(obj)
  414. * const tween2 = new TWEEN.Tween(obj2)
  415. *
  416. * //...
  417. *
  418. * const group = new Group()
  419. * group.add(tween)
  420. * group.add(tween2)
  421. *
  422. * //...
  423. *
  424. * requestAnimationFrame(function loop(time) {
  425. * group.update(time)
  426. * requestAnimationFrame(loop)
  427. * })
  428. * ```
  429. */
  430. declare const update: {
  431. (time?: number | undefined): void;
  432. (time?: number | undefined, preserve?: boolean | undefined): void;
  433. };
  434. declare const exports: {
  435. Easing: Readonly<{
  436. Linear: Readonly<EasingFunctionGroup & {
  437. None: EasingFunction;
  438. }>;
  439. Quadratic: Readonly<EasingFunctionGroup>;
  440. Cubic: Readonly<EasingFunctionGroup>;
  441. Quartic: Readonly<EasingFunctionGroup>;
  442. Quintic: Readonly<EasingFunctionGroup>;
  443. Sinusoidal: Readonly<EasingFunctionGroup>;
  444. Exponential: Readonly<EasingFunctionGroup>;
  445. Circular: Readonly<EasingFunctionGroup>;
  446. Elastic: Readonly<EasingFunctionGroup>;
  447. Back: Readonly<EasingFunctionGroup>;
  448. Bounce: Readonly<EasingFunctionGroup>;
  449. generatePow(power?: number): EasingFunctionGroup;
  450. }>;
  451. Group: typeof Group;
  452. Interpolation: {
  453. Linear: (v: number[], k: number) => number;
  454. Bezier: (v: number[], k: number) => number;
  455. CatmullRom: (v: number[], k: number) => number;
  456. Utils: {
  457. Linear: (p0: number, p1: number, t: number) => number;
  458. Bernstein: (n: number, i: number) => number;
  459. Factorial: (n: number) => number;
  460. CatmullRom: (p0: number, p1: number, p2: number, p3: number, t: number) => number;
  461. };
  462. };
  463. now: () => number;
  464. Sequence: typeof Sequence;
  465. nextId: typeof Sequence.nextId;
  466. Tween: typeof Tween;
  467. VERSION: string;
  468. /**
  469. * @deprecated The global TWEEN Group will be removed in a following major
  470. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  471. * group.
  472. *
  473. * Old code:
  474. *
  475. * ```js
  476. * import * as TWEEN from '@tweenjs/tween.js'
  477. *
  478. * //...
  479. *
  480. * const tween = new TWEEN.Tween(obj)
  481. * const tween2 = new TWEEN.Tween(obj2)
  482. *
  483. * //...
  484. *
  485. * requestAnimationFrame(function loop(time) {
  486. * TWEEN.update(time)
  487. * requestAnimationFrame(loop)
  488. * })
  489. * ```
  490. *
  491. * New code:
  492. *
  493. * ```js
  494. * import {Tween, Group} from '@tweenjs/tween.js'
  495. *
  496. * //...
  497. *
  498. * const tween = new Tween(obj)
  499. * const tween2 = new TWEEN.Tween(obj2)
  500. *
  501. * //...
  502. *
  503. * const group = new Group()
  504. * group.add(tween)
  505. * group.add(tween2)
  506. *
  507. * //...
  508. *
  509. * requestAnimationFrame(function loop(time) {
  510. * group.update(time)
  511. * requestAnimationFrame(loop)
  512. * })
  513. * ```
  514. */
  515. getAll: () => Tween<any>[];
  516. /**
  517. * @deprecated The global TWEEN Group will be removed in a following major
  518. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  519. * group.
  520. *
  521. * Old code:
  522. *
  523. * ```js
  524. * import * as TWEEN from '@tweenjs/tween.js'
  525. *
  526. * //...
  527. *
  528. * const tween = new TWEEN.Tween(obj)
  529. * const tween2 = new TWEEN.Tween(obj2)
  530. *
  531. * //...
  532. *
  533. * requestAnimationFrame(function loop(time) {
  534. * TWEEN.update(time)
  535. * requestAnimationFrame(loop)
  536. * })
  537. * ```
  538. *
  539. * New code:
  540. *
  541. * ```js
  542. * import {Tween, Group} from '@tweenjs/tween.js'
  543. *
  544. * //...
  545. *
  546. * const tween = new Tween(obj)
  547. * const tween2 = new TWEEN.Tween(obj2)
  548. *
  549. * //...
  550. *
  551. * const group = new Group()
  552. * group.add(tween)
  553. * group.add(tween2)
  554. *
  555. * //...
  556. *
  557. * requestAnimationFrame(function loop(time) {
  558. * group.update(time)
  559. * requestAnimationFrame(loop)
  560. * })
  561. * ```
  562. */
  563. removeAll: () => void;
  564. /**
  565. * @deprecated The global TWEEN Group will be removed in a following major
  566. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  567. * group.
  568. *
  569. * Old code:
  570. *
  571. * ```js
  572. * import * as TWEEN from '@tweenjs/tween.js'
  573. *
  574. * //...
  575. *
  576. * const tween = new TWEEN.Tween(obj)
  577. * const tween2 = new TWEEN.Tween(obj2)
  578. *
  579. * //...
  580. *
  581. * requestAnimationFrame(function loop(time) {
  582. * TWEEN.update(time)
  583. * requestAnimationFrame(loop)
  584. * })
  585. * ```
  586. *
  587. * New code:
  588. *
  589. * ```js
  590. * import {Tween, Group} from '@tweenjs/tween.js'
  591. *
  592. * //...
  593. *
  594. * const tween = new Tween(obj)
  595. * const tween2 = new TWEEN.Tween(obj2)
  596. *
  597. * //...
  598. *
  599. * const group = new Group()
  600. * group.add(tween)
  601. * group.add(tween2)
  602. *
  603. * //...
  604. *
  605. * requestAnimationFrame(function loop(time) {
  606. * group.update(time)
  607. * requestAnimationFrame(loop)
  608. * })
  609. * ```
  610. */
  611. add: (...tweens: Tween<any>[]) => void;
  612. /**
  613. * @deprecated The global TWEEN Group will be removed in a following major
  614. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  615. * group.
  616. *
  617. * Old code:
  618. *
  619. * ```js
  620. * import * as TWEEN from '@tweenjs/tween.js'
  621. *
  622. * //...
  623. *
  624. * const tween = new TWEEN.Tween(obj)
  625. * const tween2 = new TWEEN.Tween(obj2)
  626. *
  627. * //...
  628. *
  629. * requestAnimationFrame(function loop(time) {
  630. * TWEEN.update(time)
  631. * requestAnimationFrame(loop)
  632. * })
  633. * ```
  634. *
  635. * New code:
  636. *
  637. * ```js
  638. * import {Tween, Group} from '@tweenjs/tween.js'
  639. *
  640. * //...
  641. *
  642. * const tween = new Tween(obj)
  643. * const tween2 = new TWEEN.Tween(obj2)
  644. *
  645. * //...
  646. *
  647. * const group = new Group()
  648. * group.add(tween)
  649. * group.add(tween2)
  650. *
  651. * //...
  652. *
  653. * requestAnimationFrame(function loop(time) {
  654. * group.update(time)
  655. * requestAnimationFrame(loop)
  656. * })
  657. * ```
  658. */
  659. remove: (...tweens: Tween<any>[]) => void;
  660. /**
  661. * @deprecated The global TWEEN Group will be removed in a following major
  662. * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
  663. * group.
  664. *
  665. * Old code:
  666. *
  667. * ```js
  668. * import * as TWEEN from '@tweenjs/tween.js'
  669. *
  670. * //...
  671. *
  672. * const tween = new TWEEN.Tween(obj)
  673. * const tween2 = new TWEEN.Tween(obj2)
  674. *
  675. * //...
  676. *
  677. * requestAnimationFrame(function loop(time) {
  678. * TWEEN.update(time)
  679. * requestAnimationFrame(loop)
  680. * })
  681. * ```
  682. *
  683. * New code:
  684. *
  685. * ```js
  686. * import {Tween, Group} from '@tweenjs/tween.js'
  687. *
  688. * //...
  689. *
  690. * const tween = new Tween(obj)
  691. * const tween2 = new TWEEN.Tween(obj2)
  692. *
  693. * //...
  694. *
  695. * const group = new Group()
  696. * group.add(tween)
  697. * group.add(tween2)
  698. *
  699. * //...
  700. *
  701. * requestAnimationFrame(function loop(time) {
  702. * group.update(time)
  703. * requestAnimationFrame(loop)
  704. * })
  705. * ```
  706. */
  707. update: {
  708. (time?: number | undefined): void;
  709. (time?: number | undefined, preserve?: boolean | undefined): void;
  710. };
  711. };
  712. export { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, exports as default, getAll, nextId, now, remove, removeAll, update };