first commit
This commit is contained in:
23
web-app/node_modules/@tweenjs/tween.js/LICENSE
generated
vendored
Normal file
23
web-app/node_modules/@tweenjs/tween.js/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2012 Tween.js authors.
|
||||
|
||||
Easing equations Copyright (c) 2001 Robert Penner http://robertpenner.com/easing/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
396
web-app/node_modules/@tweenjs/tween.js/README.md
generated
vendored
Normal file
396
web-app/node_modules/@tweenjs/tween.js/README.md
generated
vendored
Normal file
@@ -0,0 +1,396 @@
|
||||
# tween.js
|
||||
|
||||
JavaScript (TypeScript) tweening engine for easy animations, incorporating optimised Robert Penner's equations.
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![CDNJS][cdnjs-image]][cdnjs-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Build and Tests][ci-image]][ci-url]
|
||||
|
||||
More languages: [English](./README.md), [简体中文](./README_zh-CN.md)
|
||||
|
||||
---
|
||||
|
||||
```html
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tween.js/20.0.0/tween.umd.js"></script>
|
||||
|
||||
<div id="box"></div>
|
||||
|
||||
<style>
|
||||
#box {
|
||||
background-color: deeppink;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
const box = document.getElementById('box') // Get the element we want to animate.
|
||||
|
||||
const coords = {x: 0, y: 0} // Start at (0, 0)
|
||||
|
||||
const tween = new TWEEN.Tween(coords, false) // Create a new tween that modifies 'coords'.
|
||||
.to({x: 300, y: 200}, 1000) // Move to (300, 200) in 1 second.
|
||||
.easing(TWEEN.Easing.Quadratic.InOut) // Use an easing function to make the animation smooth.
|
||||
.onUpdate(() => {
|
||||
// Called after tween.js updates 'coords'.
|
||||
// Move 'box' to the position described by 'coords' with a CSS translation.
|
||||
box.style.setProperty('transform', 'translate(' + coords.x + 'px, ' + coords.y + 'px)')
|
||||
})
|
||||
.start() // Start the tween immediately.
|
||||
|
||||
// Setup the animation loop.
|
||||
function animate(time) {
|
||||
tween.update(time)
|
||||
requestAnimationFrame(animate)
|
||||
}
|
||||
requestAnimationFrame(animate)
|
||||
</script>
|
||||
```
|
||||
|
||||
[Try this example on CodePen](https://codepen.io/trusktr/pen/KKGaBVz?editors=1000)
|
||||
|
||||
# Installation
|
||||
|
||||
## From CDN
|
||||
|
||||
Install from a content-delivery network (CDN) like in the above example.
|
||||
|
||||
From cdnjs:
|
||||
|
||||
```html
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tween.js/20.0.0/tween.umd.js"></script>
|
||||
```
|
||||
|
||||
Or from unpkg.com:
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/@tweenjs/tween.js@^20.0.0/dist/tween.umd.js"></script>
|
||||
```
|
||||
|
||||
Note that unpkg.com supports a semver version in the URL, where the `^` in the URL tells unpkg to give you the latest version 20.x.x.
|
||||
|
||||
## Build and include in your project with script tag
|
||||
|
||||
Currently npm is required to build the project.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/tweenjs/tween.js
|
||||
cd tween.js
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
This will create some builds in the `dist` directory. There are currently two different builds of the library:
|
||||
|
||||
- UMD : `tween.umd.js`
|
||||
- ES6 Module : `tween.es.js`
|
||||
|
||||
You are now able to copy tween.umd.js into your project, then include it with
|
||||
a script tag, which will add TWEEN to the global scope,
|
||||
|
||||
```html
|
||||
<script src="path/to/tween.umd.js"></script>
|
||||
```
|
||||
|
||||
or import TWEEN as a JavaScript module,
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import * as TWEEN from 'path/to/tween.es.js'
|
||||
</script>
|
||||
```
|
||||
|
||||
where `path/to` is replaced with the location where you placed the file.
|
||||
|
||||
## With `npm install` and `import` from `node_modules`
|
||||
|
||||
You can add tween.js as an npm dependency:
|
||||
|
||||
```bash
|
||||
npm install @tweenjs/tween.js
|
||||
```
|
||||
|
||||
### With a build tool
|
||||
|
||||
If you are using [Node.js](https://nodejs.org/), [Parcel](https://parceljs.org/), [Webpack](https://webpack.js.org/), [Rollup](https://rollupjs.org/), [Vite](https://vitejs.dev/), or another build tool, then you can now use the following to include tween.js:
|
||||
|
||||
```javascript
|
||||
import * as TWEEN from '@tweenjs/tween.js'
|
||||
```
|
||||
|
||||
### Without a build tool
|
||||
|
||||
You can import from `node_modules` if you serve node_modules as part of your website, using an `importmap` script tag. First, assuming `node_modules` is at the root of your website, you can write an import map:
|
||||
|
||||
```html
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"@tweenjs/tween.js": "/node_modules/@tweenjs/tween.js/dist/tween.es.js"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
Now in any of your module scripts you can import it by its package name:
|
||||
|
||||
```javascript
|
||||
import * as TWEEN from '@tweenjs/tween.js'
|
||||
```
|
||||
|
||||
# Features
|
||||
|
||||
- Does one thing and one thing only: tween properties
|
||||
- Doesn't take care of CSS units (e.g. appending `px`)
|
||||
- Doesn't interpolate colors
|
||||
- Easing functions are reusable outside of Tween
|
||||
- Can also use custom easing functions
|
||||
|
||||
# Documentation
|
||||
|
||||
- [User guide](./docs/user_guide.md)
|
||||
- [Contributor guide](./docs/contributor_guide.md)
|
||||
- [Tutorial](https://web.archive.org/web/20220601192930/http://learningthreejs.com/blog/2011/08/17/tweenjs-for-smooth-animation/) using tween.js with three.js
|
||||
- Also: [libtween](https://github.com/jsm174/libtween), a port of tween.js to C by [jsm174](https://github.com/jsm174)
|
||||
|
||||
# Examples
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/00_hello_world.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/00_hello_world.png" alt="hello world" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
hello world<br />
|
||||
(<a href="examples/00_hello_world.html">source</a>)
|
||||
</td>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/01_bars.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/01_bars.png" alt="Bars" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Bars<br />
|
||||
(<a href="examples/01_bars.html">source</a>)
|
||||
</td>
|
||||
<tr>
|
||||
</tr>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/02_black_and_red.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/02_black_and_red.png" alt="Black and red" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Black and red<br />
|
||||
(<a href="examples/02_black_and_red.html">source</a>)
|
||||
</td>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/03_graphs.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/03_graphs.png" alt="Graphs" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Graphs<br />
|
||||
(<a href="examples/03_graphs.html">source</a>)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/04_simplest.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/04_simplest.png" alt="Simplest possible example" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Simplest possible example<br />
|
||||
(<a href="examples/04_simplest.html">source</a>)
|
||||
</td>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/05_video_and_time.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/06_video_and_time.png" alt="Video and time" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Video and time<br />
|
||||
(<a href="examples/05_video_and_time.html">source</a>)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/06_array_interpolation.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/03_graphs.png" alt="Array interpolation" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Array interpolation<br />
|
||||
(<a href="examples/06_array_interpolation.html">source</a>)
|
||||
</td>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/07_dynamic_to.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/07_dynamic_to.png" alt="Dynamic to, object" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Dynamic to, object<br />
|
||||
(<a href="examples/07_dynamic_to.html">source</a>)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/07a_dynamic_to_two_array_values.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/07a_dynamic_to.png" alt="Dynamic to, interpolation array" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Dynamic to, interpolation array<br />
|
||||
(<a href="examples/07a_dynamic_to_two_array_values.html">source</a>)
|
||||
</td>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/07b_dynamic_to_an_array_of_values.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/07b_dynamic_to.png" alt="Dynamic to, large interpolation array" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Dynamic to, large interpolation array<br />
|
||||
(<a href="examples/07b_dynamic_to_an_array_of_values.html">source</a>)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/08_repeat.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/08_repeat.png" alt="Repeat" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Repeat<br />
|
||||
(<a href="examples/08_repeat.html">source</a>)
|
||||
</td>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/09_relative_values.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/09_relative.png" alt="Relative values" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Relative values<br />
|
||||
(<a href="examples/09_relative_values.html">source</a>)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/10_yoyo.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/10_yoyo.png" alt="Yoyo" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Yoyo<br />
|
||||
(<a href="examples/10_yoyo.html">source</a>)
|
||||
</td>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/11_stop_all_chained_tweens.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/11_stop_all_chained_tweens.png" alt="Stop all chained tweens" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Stop all chained tweens<br />
|
||||
(<a href="examples/11_stop_all_chained_tweens.html">source</a>)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/12_graphs_custom_functions.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/03_graphs.png" alt="Custom functions" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Custom functions<br />
|
||||
(<a href="examples/12_graphs_custom_functions.html">source</a>)
|
||||
</td>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/13_relative_start_time.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/13_relative_start_time.png" alt="Relative start time" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Relative start time<br />
|
||||
(<a href="examples/13_relative_start_time.html">source</a>)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/14_pause_tween.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/14_pause_tween.png" alt="Pause tween" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Pause tween<br />
|
||||
(<a href="examples/14_pause_tween.html">source</a>)
|
||||
</td>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/15_complex_properties.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/15_complex_properties.png" alt="Complex properties" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Complex properties<br />
|
||||
(<a href="examples/15_complex_properties.html">source</a>)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://tweenjs.github.io/tween.js/examples/16_animate_an_array_of_values.html">
|
||||
<img width="100" height="50" src="https://tweenjs.github.io/tween.js/assets/examples/16_animate_an_array_of_values.png" alt="Animate an array of values" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
Animate an array of values<br />
|
||||
(<a href="examples/16_animate_an_array_of_values.html">source</a>)
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# Tests
|
||||
|
||||
You need to install `npm` first--this comes with node.js, so install that one first. Then, cd to `tween.js`'s (or wherever you cloned the repo) directory and run:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
To run the tests run:
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
If you want to add any feature or change existing features, you _must_ run the tests to make sure you didn't break anything else. Any pull request (PR) needs to have updated passing tests for feature changes (or new passing tests for new features or fixes) in `src/tests.ts` a PR to be accepted. See [contributing](CONTRIBUTING.md) for more information.
|
||||
|
||||
# People
|
||||
|
||||
Maintainers: [Joe Pea (@trusktr)](https://github.com/trusktr).
|
||||
|
||||
[All contributors](http://github.com/tweenjs/tween.js/contributors).
|
||||
|
||||
# Projects using tween.js
|
||||
|
||||
[<img src="./assets/projects/11_lume.jpg" width="100" alt="Lume" />](https://lume.io)
|
||||
[](https://aframe.io)
|
||||
[](http://www.moma.org/interactives/exhibitions/2012/inventingabstraction/)
|
||||
[](http://www.chromeweblab.com/)
|
||||
[](http://5013.es/toys/macchina)
|
||||
[](http://egraether.com/mine3d/)
|
||||
[](http://ro.me)
|
||||
[](http://data-arts.appspot.com/globe)
|
||||
[](http://www.androidify.com/)
|
||||
[](http://thewildernessdowntown.com/)
|
||||
[](http://dejavis.org/linechart)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/@tweenjs/tween.js.svg
|
||||
[npm-url]: https://npmjs.org/package/@tweenjs/tween.js
|
||||
[downloads-image]: https://img.shields.io/npm/dm/@tweenjs/tween.js.svg
|
||||
[downloads-url]: https://npmjs.org/package/@tweenjs/tween.js
|
||||
[ci-image]: https://github.com/tweenjs/tween.js/workflows/build%20and%20tests/badge.svg?branch=master
|
||||
[ci-url]: https://github.com/tweenjs/tween.js/actions
|
||||
[cdnjs-image]: https://img.shields.io/cdnjs/v/tween.js.svg
|
||||
[cdnjs-url]: https://cdnjs.com/libraries/tween.js
|
||||
895
web-app/node_modules/@tweenjs/tween.js/dist/tween.amd.js
generated
vendored
Normal file
895
web-app/node_modules/@tweenjs/tween.js/dist/tween.amd.js
generated
vendored
Normal file
@@ -0,0 +1,895 @@
|
||||
define(['exports'], (function (exports) { 'use strict';
|
||||
|
||||
/**
|
||||
* The Ease class provides a collection of easing functions for use with tween.js.
|
||||
*/
|
||||
var Easing = Object.freeze({
|
||||
Linear: Object.freeze({
|
||||
None: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
In: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
}),
|
||||
Quadratic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount * (2 - amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount;
|
||||
}
|
||||
return -0.5 * (--amount * (amount - 2) - 1);
|
||||
},
|
||||
}),
|
||||
Cubic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return --amount * amount * amount + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount;
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * amount + 2);
|
||||
},
|
||||
}),
|
||||
Quartic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return 1 - --amount * amount * amount * amount;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount * amount;
|
||||
}
|
||||
return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
|
||||
},
|
||||
}),
|
||||
Quintic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return --amount * amount * amount * amount * amount + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount * amount * amount;
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
|
||||
},
|
||||
}),
|
||||
Sinusoidal: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return Math.sin((amount * Math.PI) / 2);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
|
||||
},
|
||||
}),
|
||||
Exponential: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount === 0 ? 0 : Math.pow(1024, amount - 1);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * Math.pow(1024, amount - 1);
|
||||
}
|
||||
return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
|
||||
},
|
||||
}),
|
||||
Circular: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Math.sqrt(1 - amount * amount);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return Math.sqrt(1 - --amount * amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return -0.5 * (Math.sqrt(1 - amount * amount) - 1);
|
||||
}
|
||||
return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
|
||||
},
|
||||
}),
|
||||
Elastic: Object.freeze({
|
||||
In: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
|
||||
},
|
||||
Out: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
amount *= 2;
|
||||
if (amount < 1) {
|
||||
return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
|
||||
}
|
||||
return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
|
||||
},
|
||||
}),
|
||||
Back: Object.freeze({
|
||||
In: function (amount) {
|
||||
var s = 1.70158;
|
||||
return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
|
||||
},
|
||||
Out: function (amount) {
|
||||
var s = 1.70158;
|
||||
return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
var s = 1.70158 * 1.525;
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * (amount * amount * ((s + 1) * amount - s));
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
|
||||
},
|
||||
}),
|
||||
Bounce: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Easing.Bounce.Out(1 - amount);
|
||||
},
|
||||
Out: function (amount) {
|
||||
if (amount < 1 / 2.75) {
|
||||
return 7.5625 * amount * amount;
|
||||
}
|
||||
else if (amount < 2 / 2.75) {
|
||||
return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;
|
||||
}
|
||||
else if (amount < 2.5 / 2.75) {
|
||||
return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;
|
||||
}
|
||||
else {
|
||||
return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;
|
||||
}
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount < 0.5) {
|
||||
return Easing.Bounce.In(amount * 2) * 0.5;
|
||||
}
|
||||
return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
|
||||
},
|
||||
}),
|
||||
generatePow: function (power) {
|
||||
if (power === void 0) { power = 4; }
|
||||
power = power < Number.EPSILON ? Number.EPSILON : power;
|
||||
power = power > 10000 ? 10000 : power;
|
||||
return {
|
||||
In: function (amount) {
|
||||
return Math.pow(amount, power);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return 1 - Math.pow((1 - amount), power);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount < 0.5) {
|
||||
return Math.pow((amount * 2), power) / 2;
|
||||
}
|
||||
return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
var now = function () { return performance.now(); };
|
||||
|
||||
/**
|
||||
* Controlling groups of tweens
|
||||
*
|
||||
* Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
|
||||
* In these cases, you may want to create your own smaller groups of tween
|
||||
*/
|
||||
var Group = /** @class */ (function () {
|
||||
function Group() {
|
||||
this._tweens = {};
|
||||
this._tweensAddedDuringUpdate = {};
|
||||
}
|
||||
Group.prototype.getAll = function () {
|
||||
var _this = this;
|
||||
return Object.keys(this._tweens).map(function (tweenId) {
|
||||
return _this._tweens[tweenId];
|
||||
});
|
||||
};
|
||||
Group.prototype.removeAll = function () {
|
||||
this._tweens = {};
|
||||
};
|
||||
Group.prototype.add = function (tween) {
|
||||
this._tweens[tween.getId()] = tween;
|
||||
this._tweensAddedDuringUpdate[tween.getId()] = tween;
|
||||
};
|
||||
Group.prototype.remove = function (tween) {
|
||||
delete this._tweens[tween.getId()];
|
||||
delete this._tweensAddedDuringUpdate[tween.getId()];
|
||||
};
|
||||
Group.prototype.update = function (time, preserve) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (preserve === void 0) { preserve = false; }
|
||||
var tweenIds = Object.keys(this._tweens);
|
||||
if (tweenIds.length === 0) {
|
||||
return false;
|
||||
}
|
||||
// Tweens are updated in "batches". If you add a new tween during an
|
||||
// update, then the new tween will be updated in the next batch.
|
||||
// If you remove a tween during an update, it may or may not be updated.
|
||||
// However, if the removed tween was added during the current batch,
|
||||
// then it will not be updated.
|
||||
while (tweenIds.length > 0) {
|
||||
this._tweensAddedDuringUpdate = {};
|
||||
for (var i = 0; i < tweenIds.length; i++) {
|
||||
var tween = this._tweens[tweenIds[i]];
|
||||
var autoStart = !preserve;
|
||||
if (tween && tween.update(time, autoStart) === false && !preserve) {
|
||||
delete this._tweens[tweenIds[i]];
|
||||
}
|
||||
}
|
||||
tweenIds = Object.keys(this._tweensAddedDuringUpdate);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
return Group;
|
||||
}());
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var Interpolation = {
|
||||
Linear: function (v, k) {
|
||||
var m = v.length - 1;
|
||||
var f = m * k;
|
||||
var i = Math.floor(f);
|
||||
var fn = Interpolation.Utils.Linear;
|
||||
if (k < 0) {
|
||||
return fn(v[0], v[1], f);
|
||||
}
|
||||
if (k > 1) {
|
||||
return fn(v[m], v[m - 1], m - f);
|
||||
}
|
||||
return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);
|
||||
},
|
||||
Bezier: function (v, k) {
|
||||
var b = 0;
|
||||
var n = v.length - 1;
|
||||
var pw = Math.pow;
|
||||
var bn = Interpolation.Utils.Bernstein;
|
||||
for (var i = 0; i <= n; i++) {
|
||||
b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
|
||||
}
|
||||
return b;
|
||||
},
|
||||
CatmullRom: function (v, k) {
|
||||
var m = v.length - 1;
|
||||
var f = m * k;
|
||||
var i = Math.floor(f);
|
||||
var fn = Interpolation.Utils.CatmullRom;
|
||||
if (v[0] === v[m]) {
|
||||
if (k < 0) {
|
||||
i = Math.floor((f = m * (1 + k)));
|
||||
}
|
||||
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
|
||||
}
|
||||
else {
|
||||
if (k < 0) {
|
||||
return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);
|
||||
}
|
||||
if (k > 1) {
|
||||
return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
|
||||
}
|
||||
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);
|
||||
}
|
||||
},
|
||||
Utils: {
|
||||
Linear: function (p0, p1, t) {
|
||||
return (p1 - p0) * t + p0;
|
||||
},
|
||||
Bernstein: function (n, i) {
|
||||
var fc = Interpolation.Utils.Factorial;
|
||||
return fc(n) / fc(i) / fc(n - i);
|
||||
},
|
||||
Factorial: (function () {
|
||||
var a = [1];
|
||||
return function (n) {
|
||||
var s = 1;
|
||||
if (a[n]) {
|
||||
return a[n];
|
||||
}
|
||||
for (var i = n; i > 1; i--) {
|
||||
s *= i;
|
||||
}
|
||||
a[n] = s;
|
||||
return s;
|
||||
};
|
||||
})(),
|
||||
CatmullRom: function (p0, p1, p2, p3, t) {
|
||||
var v0 = (p2 - p0) * 0.5;
|
||||
var v1 = (p3 - p1) * 0.5;
|
||||
var t2 = t * t;
|
||||
var t3 = t * t2;
|
||||
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Utils
|
||||
*/
|
||||
var Sequence = /** @class */ (function () {
|
||||
function Sequence() {
|
||||
}
|
||||
Sequence.nextId = function () {
|
||||
return Sequence._nextId++;
|
||||
};
|
||||
Sequence._nextId = 0;
|
||||
return Sequence;
|
||||
}());
|
||||
|
||||
var mainGroup = new Group();
|
||||
|
||||
/**
|
||||
* Tween.js - Licensed under the MIT license
|
||||
* https://github.com/tweenjs/tween.js
|
||||
* ----------------------------------------------
|
||||
*
|
||||
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
|
||||
* Thank you all, you're awesome!
|
||||
*/
|
||||
var Tween = /** @class */ (function () {
|
||||
function Tween(_object, _group) {
|
||||
if (_group === void 0) { _group = mainGroup; }
|
||||
this._object = _object;
|
||||
this._group = _group;
|
||||
this._isPaused = false;
|
||||
this._pauseStart = 0;
|
||||
this._valuesStart = {};
|
||||
this._valuesEnd = {};
|
||||
this._valuesStartRepeat = {};
|
||||
this._duration = 1000;
|
||||
this._isDynamic = false;
|
||||
this._initialRepeat = 0;
|
||||
this._repeat = 0;
|
||||
this._yoyo = false;
|
||||
this._isPlaying = false;
|
||||
this._reversed = false;
|
||||
this._delayTime = 0;
|
||||
this._startTime = 0;
|
||||
this._easingFunction = Easing.Linear.None;
|
||||
this._interpolationFunction = Interpolation.Linear;
|
||||
// eslint-disable-next-line
|
||||
this._chainedTweens = [];
|
||||
this._onStartCallbackFired = false;
|
||||
this._onEveryStartCallbackFired = false;
|
||||
this._id = Sequence.nextId();
|
||||
this._isChainStopped = false;
|
||||
this._propertiesAreSetUp = false;
|
||||
this._goToEnd = false;
|
||||
}
|
||||
Tween.prototype.getId = function () {
|
||||
return this._id;
|
||||
};
|
||||
Tween.prototype.isPlaying = function () {
|
||||
return this._isPlaying;
|
||||
};
|
||||
Tween.prototype.isPaused = function () {
|
||||
return this._isPaused;
|
||||
};
|
||||
Tween.prototype.getDuration = function () {
|
||||
return this._duration;
|
||||
};
|
||||
Tween.prototype.to = function (target, duration) {
|
||||
if (duration === void 0) { duration = 1000; }
|
||||
if (this._isPlaying)
|
||||
throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
|
||||
this._valuesEnd = target;
|
||||
this._propertiesAreSetUp = false;
|
||||
this._duration = duration < 0 ? 0 : duration;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.duration = function (duration) {
|
||||
if (duration === void 0) { duration = 1000; }
|
||||
this._duration = duration < 0 ? 0 : duration;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.dynamic = function (dynamic) {
|
||||
if (dynamic === void 0) { dynamic = false; }
|
||||
this._isDynamic = dynamic;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.start = function (time, overrideStartingValues) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (overrideStartingValues === void 0) { overrideStartingValues = false; }
|
||||
if (this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.add(this);
|
||||
this._repeat = this._initialRepeat;
|
||||
if (this._reversed) {
|
||||
// If we were reversed (f.e. using the yoyo feature) then we need to
|
||||
// flip the tween direction back to forward.
|
||||
this._reversed = false;
|
||||
for (var property in this._valuesStartRepeat) {
|
||||
this._swapEndStartRepeatValues(property);
|
||||
this._valuesStart[property] = this._valuesStartRepeat[property];
|
||||
}
|
||||
}
|
||||
this._isPlaying = true;
|
||||
this._isPaused = false;
|
||||
this._onStartCallbackFired = false;
|
||||
this._onEveryStartCallbackFired = false;
|
||||
this._isChainStopped = false;
|
||||
this._startTime = time;
|
||||
this._startTime += this._delayTime;
|
||||
if (!this._propertiesAreSetUp || overrideStartingValues) {
|
||||
this._propertiesAreSetUp = true;
|
||||
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
||||
if (!this._isDynamic) {
|
||||
var tmp = {};
|
||||
for (var prop in this._valuesEnd)
|
||||
tmp[prop] = this._valuesEnd[prop];
|
||||
this._valuesEnd = tmp;
|
||||
}
|
||||
this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.startFromCurrentValues = function (time) {
|
||||
return this.start(time, true);
|
||||
};
|
||||
Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
|
||||
for (var property in _valuesEnd) {
|
||||
var startValue = _object[property];
|
||||
var startValueIsArray = Array.isArray(startValue);
|
||||
var propType = startValueIsArray ? 'array' : typeof startValue;
|
||||
var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]);
|
||||
// If `to()` specifies a property that doesn't exist in the source object,
|
||||
// we should not set that property in the object
|
||||
if (propType === 'undefined' || propType === 'function') {
|
||||
continue;
|
||||
}
|
||||
// Check if an Array was provided as property value
|
||||
if (isInterpolationList) {
|
||||
var endValues = _valuesEnd[property];
|
||||
if (endValues.length === 0) {
|
||||
continue;
|
||||
}
|
||||
// Handle an array of relative values.
|
||||
// Creates a local copy of the Array with the start value at the front
|
||||
var temp = [startValue];
|
||||
for (var i = 0, l = endValues.length; i < l; i += 1) {
|
||||
var value = this._handleRelativeValue(startValue, endValues[i]);
|
||||
if (isNaN(value)) {
|
||||
isInterpolationList = false;
|
||||
console.warn('Found invalid interpolation list. Skipping.');
|
||||
break;
|
||||
}
|
||||
temp.push(value);
|
||||
}
|
||||
if (isInterpolationList) {
|
||||
// if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
|
||||
_valuesEnd[property] = temp;
|
||||
// }
|
||||
}
|
||||
}
|
||||
// handle the deepness of the values
|
||||
if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
|
||||
_valuesStart[property] = startValueIsArray ? [] : {};
|
||||
var nestedObject = startValue;
|
||||
for (var prop in nestedObject) {
|
||||
_valuesStart[property][prop] = nestedObject[prop];
|
||||
}
|
||||
// TODO? repeat nested values? And yoyo? And array values?
|
||||
_valuesStartRepeat[property] = startValueIsArray ? [] : {};
|
||||
var endValues = _valuesEnd[property];
|
||||
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
||||
if (!this._isDynamic) {
|
||||
var tmp = {};
|
||||
for (var prop in endValues)
|
||||
tmp[prop] = endValues[prop];
|
||||
_valuesEnd[property] = endValues = tmp;
|
||||
}
|
||||
this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
|
||||
}
|
||||
else {
|
||||
// Save the starting value, but only once unless override is requested.
|
||||
if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
|
||||
_valuesStart[property] = startValue;
|
||||
}
|
||||
if (!startValueIsArray) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings
|
||||
}
|
||||
if (isInterpolationList) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_valuesStartRepeat[property] = _valuesEnd[property].slice().reverse();
|
||||
}
|
||||
else {
|
||||
_valuesStartRepeat[property] = _valuesStart[property] || 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Tween.prototype.stop = function () {
|
||||
if (!this._isChainStopped) {
|
||||
this._isChainStopped = true;
|
||||
this.stopChainedTweens();
|
||||
}
|
||||
if (!this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.remove(this);
|
||||
this._isPlaying = false;
|
||||
this._isPaused = false;
|
||||
if (this._onStopCallback) {
|
||||
this._onStopCallback(this._object);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.end = function () {
|
||||
this._goToEnd = true;
|
||||
this.update(Infinity);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.pause = function (time) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (this._isPaused || !this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
this._isPaused = true;
|
||||
this._pauseStart = time;
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.remove(this);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.resume = function (time) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (!this._isPaused || !this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
this._isPaused = false;
|
||||
this._startTime += time - this._pauseStart;
|
||||
this._pauseStart = 0;
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.add(this);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.stopChainedTweens = function () {
|
||||
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
||||
this._chainedTweens[i].stop();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.group = function (group) {
|
||||
if (group === void 0) { group = mainGroup; }
|
||||
this._group = group;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.delay = function (amount) {
|
||||
if (amount === void 0) { amount = 0; }
|
||||
this._delayTime = amount;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.repeat = function (times) {
|
||||
if (times === void 0) { times = 0; }
|
||||
this._initialRepeat = times;
|
||||
this._repeat = times;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.repeatDelay = function (amount) {
|
||||
this._repeatDelayTime = amount;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.yoyo = function (yoyo) {
|
||||
if (yoyo === void 0) { yoyo = false; }
|
||||
this._yoyo = yoyo;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.easing = function (easingFunction) {
|
||||
if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
|
||||
this._easingFunction = easingFunction;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.interpolation = function (interpolationFunction) {
|
||||
if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
|
||||
this._interpolationFunction = interpolationFunction;
|
||||
return this;
|
||||
};
|
||||
// eslint-disable-next-line
|
||||
Tween.prototype.chain = function () {
|
||||
var tweens = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
tweens[_i] = arguments[_i];
|
||||
}
|
||||
this._chainedTweens = tweens;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onStart = function (callback) {
|
||||
this._onStartCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onEveryStart = function (callback) {
|
||||
this._onEveryStartCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onUpdate = function (callback) {
|
||||
this._onUpdateCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onRepeat = function (callback) {
|
||||
this._onRepeatCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onComplete = function (callback) {
|
||||
this._onCompleteCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onStop = function (callback) {
|
||||
this._onStopCallback = callback;
|
||||
return this;
|
||||
};
|
||||
/**
|
||||
* @returns true if the tween is still playing after the update, false
|
||||
* otherwise (calling update on a paused tween still returns true because
|
||||
* it is still playing, just paused).
|
||||
*/
|
||||
Tween.prototype.update = function (time, autoStart) {
|
||||
var _this = this;
|
||||
var _a;
|
||||
if (time === void 0) { time = now(); }
|
||||
if (autoStart === void 0) { autoStart = true; }
|
||||
if (this._isPaused)
|
||||
return true;
|
||||
var property;
|
||||
var endTime = this._startTime + this._duration;
|
||||
if (!this._goToEnd && !this._isPlaying) {
|
||||
if (time > endTime)
|
||||
return false;
|
||||
if (autoStart)
|
||||
this.start(time, true);
|
||||
}
|
||||
this._goToEnd = false;
|
||||
if (time < this._startTime) {
|
||||
return true;
|
||||
}
|
||||
if (this._onStartCallbackFired === false) {
|
||||
if (this._onStartCallback) {
|
||||
this._onStartCallback(this._object);
|
||||
}
|
||||
this._onStartCallbackFired = true;
|
||||
}
|
||||
if (this._onEveryStartCallbackFired === false) {
|
||||
if (this._onEveryStartCallback) {
|
||||
this._onEveryStartCallback(this._object);
|
||||
}
|
||||
this._onEveryStartCallbackFired = true;
|
||||
}
|
||||
var elapsedTime = time - this._startTime;
|
||||
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
||||
var totalTime = this._duration + this._repeat * durationAndDelay;
|
||||
var calculateElapsedPortion = function () {
|
||||
if (_this._duration === 0)
|
||||
return 1;
|
||||
if (elapsedTime > totalTime) {
|
||||
return 1;
|
||||
}
|
||||
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
||||
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
||||
// TODO use %?
|
||||
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
||||
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
||||
if (portion === 0 && elapsedTime === _this._duration) {
|
||||
return 1;
|
||||
}
|
||||
return portion;
|
||||
};
|
||||
var elapsed = calculateElapsedPortion();
|
||||
var value = this._easingFunction(elapsed);
|
||||
// properties transformations
|
||||
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
||||
if (this._onUpdateCallback) {
|
||||
this._onUpdateCallback(this._object, elapsed);
|
||||
}
|
||||
if (this._duration === 0 || elapsedTime >= this._duration) {
|
||||
if (this._repeat > 0) {
|
||||
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
||||
if (isFinite(this._repeat)) {
|
||||
this._repeat -= completeCount;
|
||||
}
|
||||
// Reassign starting values, restart by making startTime = now
|
||||
for (property in this._valuesStartRepeat) {
|
||||
if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {
|
||||
this._valuesStartRepeat[property] =
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
|
||||
}
|
||||
if (this._yoyo) {
|
||||
this._swapEndStartRepeatValues(property);
|
||||
}
|
||||
this._valuesStart[property] = this._valuesStartRepeat[property];
|
||||
}
|
||||
if (this._yoyo) {
|
||||
this._reversed = !this._reversed;
|
||||
}
|
||||
this._startTime += durationAndDelay * completeCount;
|
||||
if (this._onRepeatCallback) {
|
||||
this._onRepeatCallback(this._object);
|
||||
}
|
||||
this._onEveryStartCallbackFired = false;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (this._onCompleteCallback) {
|
||||
this._onCompleteCallback(this._object);
|
||||
}
|
||||
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
||||
// Make the chained tweens start exactly at the time they should,
|
||||
// even if the `update()` method was called way past the duration of the tween
|
||||
this._chainedTweens[i].start(this._startTime + this._duration, false);
|
||||
}
|
||||
this._isPlaying = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {
|
||||
for (var property in _valuesEnd) {
|
||||
// Don't update properties that do not exist in the source object
|
||||
if (_valuesStart[property] === undefined) {
|
||||
continue;
|
||||
}
|
||||
var start = _valuesStart[property] || 0;
|
||||
var end = _valuesEnd[property];
|
||||
var startIsArray = Array.isArray(_object[property]);
|
||||
var endIsArray = Array.isArray(end);
|
||||
var isInterpolationList = !startIsArray && endIsArray;
|
||||
if (isInterpolationList) {
|
||||
_object[property] = this._interpolationFunction(end, value);
|
||||
}
|
||||
else if (typeof end === 'object' && end) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
this._updateProperties(_object[property], start, end, value);
|
||||
}
|
||||
else {
|
||||
// Parses relative end values with start as base (e.g.: +10, -3)
|
||||
end = this._handleRelativeValue(start, end);
|
||||
// Protect against non numeric properties.
|
||||
if (typeof end === 'number') {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_object[property] = start + (end - start) * value;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Tween.prototype._handleRelativeValue = function (start, end) {
|
||||
if (typeof end !== 'string') {
|
||||
return end;
|
||||
}
|
||||
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
|
||||
return start + parseFloat(end);
|
||||
}
|
||||
return parseFloat(end);
|
||||
};
|
||||
Tween.prototype._swapEndStartRepeatValues = function (property) {
|
||||
var tmp = this._valuesStartRepeat[property];
|
||||
var endValue = this._valuesEnd[property];
|
||||
if (typeof endValue === 'string') {
|
||||
this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);
|
||||
}
|
||||
else {
|
||||
this._valuesStartRepeat[property] = this._valuesEnd[property];
|
||||
}
|
||||
this._valuesEnd[property] = tmp;
|
||||
};
|
||||
return Tween;
|
||||
}());
|
||||
|
||||
var VERSION = '23.1.3';
|
||||
|
||||
/**
|
||||
* Tween.js - Licensed under the MIT license
|
||||
* https://github.com/tweenjs/tween.js
|
||||
* ----------------------------------------------
|
||||
*
|
||||
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
|
||||
* Thank you all, you're awesome!
|
||||
*/
|
||||
var nextId = Sequence.nextId;
|
||||
/**
|
||||
* Controlling groups of tweens
|
||||
*
|
||||
* Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
|
||||
* In these cases, you may want to create your own smaller groups of tweens.
|
||||
*/
|
||||
var TWEEN = mainGroup;
|
||||
// This is the best way to export things in a way that's compatible with both ES
|
||||
// Modules and CommonJS, without build hacks, and so as not to break the
|
||||
// existing API.
|
||||
// https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
|
||||
var getAll = TWEEN.getAll.bind(TWEEN);
|
||||
var removeAll = TWEEN.removeAll.bind(TWEEN);
|
||||
var add = TWEEN.add.bind(TWEEN);
|
||||
var remove = TWEEN.remove.bind(TWEEN);
|
||||
var update = TWEEN.update.bind(TWEEN);
|
||||
var exports$1 = {
|
||||
Easing: Easing,
|
||||
Group: Group,
|
||||
Interpolation: Interpolation,
|
||||
now: now,
|
||||
Sequence: Sequence,
|
||||
nextId: nextId,
|
||||
Tween: Tween,
|
||||
VERSION: VERSION,
|
||||
getAll: getAll,
|
||||
removeAll: removeAll,
|
||||
add: add,
|
||||
remove: remove,
|
||||
update: update,
|
||||
};
|
||||
|
||||
exports.Easing = Easing;
|
||||
exports.Group = Group;
|
||||
exports.Interpolation = Interpolation;
|
||||
exports.Sequence = Sequence;
|
||||
exports.Tween = Tween;
|
||||
exports.VERSION = VERSION;
|
||||
exports.add = add;
|
||||
exports.default = exports$1;
|
||||
exports.getAll = getAll;
|
||||
exports.nextId = nextId;
|
||||
exports.now = now;
|
||||
exports.remove = remove;
|
||||
exports.removeAll = removeAll;
|
||||
exports.update = update;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
893
web-app/node_modules/@tweenjs/tween.js/dist/tween.cjs
generated
vendored
Normal file
893
web-app/node_modules/@tweenjs/tween.js/dist/tween.cjs
generated
vendored
Normal file
@@ -0,0 +1,893 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
/**
|
||||
* The Ease class provides a collection of easing functions for use with tween.js.
|
||||
*/
|
||||
var Easing = Object.freeze({
|
||||
Linear: Object.freeze({
|
||||
None: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
In: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
}),
|
||||
Quadratic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount * (2 - amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount;
|
||||
}
|
||||
return -0.5 * (--amount * (amount - 2) - 1);
|
||||
},
|
||||
}),
|
||||
Cubic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return --amount * amount * amount + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount;
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * amount + 2);
|
||||
},
|
||||
}),
|
||||
Quartic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return 1 - --amount * amount * amount * amount;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount * amount;
|
||||
}
|
||||
return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
|
||||
},
|
||||
}),
|
||||
Quintic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return --amount * amount * amount * amount * amount + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount * amount * amount;
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
|
||||
},
|
||||
}),
|
||||
Sinusoidal: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return Math.sin((amount * Math.PI) / 2);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
|
||||
},
|
||||
}),
|
||||
Exponential: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount === 0 ? 0 : Math.pow(1024, amount - 1);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * Math.pow(1024, amount - 1);
|
||||
}
|
||||
return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
|
||||
},
|
||||
}),
|
||||
Circular: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Math.sqrt(1 - amount * amount);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return Math.sqrt(1 - --amount * amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return -0.5 * (Math.sqrt(1 - amount * amount) - 1);
|
||||
}
|
||||
return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
|
||||
},
|
||||
}),
|
||||
Elastic: Object.freeze({
|
||||
In: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
|
||||
},
|
||||
Out: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
amount *= 2;
|
||||
if (amount < 1) {
|
||||
return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
|
||||
}
|
||||
return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
|
||||
},
|
||||
}),
|
||||
Back: Object.freeze({
|
||||
In: function (amount) {
|
||||
var s = 1.70158;
|
||||
return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
|
||||
},
|
||||
Out: function (amount) {
|
||||
var s = 1.70158;
|
||||
return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
var s = 1.70158 * 1.525;
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * (amount * amount * ((s + 1) * amount - s));
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
|
||||
},
|
||||
}),
|
||||
Bounce: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Easing.Bounce.Out(1 - amount);
|
||||
},
|
||||
Out: function (amount) {
|
||||
if (amount < 1 / 2.75) {
|
||||
return 7.5625 * amount * amount;
|
||||
}
|
||||
else if (amount < 2 / 2.75) {
|
||||
return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;
|
||||
}
|
||||
else if (amount < 2.5 / 2.75) {
|
||||
return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;
|
||||
}
|
||||
else {
|
||||
return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;
|
||||
}
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount < 0.5) {
|
||||
return Easing.Bounce.In(amount * 2) * 0.5;
|
||||
}
|
||||
return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
|
||||
},
|
||||
}),
|
||||
generatePow: function (power) {
|
||||
if (power === void 0) { power = 4; }
|
||||
power = power < Number.EPSILON ? Number.EPSILON : power;
|
||||
power = power > 10000 ? 10000 : power;
|
||||
return {
|
||||
In: function (amount) {
|
||||
return Math.pow(amount, power);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return 1 - Math.pow((1 - amount), power);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount < 0.5) {
|
||||
return Math.pow((amount * 2), power) / 2;
|
||||
}
|
||||
return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
var now = function () { return performance.now(); };
|
||||
|
||||
/**
|
||||
* Controlling groups of tweens
|
||||
*
|
||||
* Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
|
||||
* In these cases, you may want to create your own smaller groups of tween
|
||||
*/
|
||||
var Group = /** @class */ (function () {
|
||||
function Group() {
|
||||
this._tweens = {};
|
||||
this._tweensAddedDuringUpdate = {};
|
||||
}
|
||||
Group.prototype.getAll = function () {
|
||||
var _this = this;
|
||||
return Object.keys(this._tweens).map(function (tweenId) {
|
||||
return _this._tweens[tweenId];
|
||||
});
|
||||
};
|
||||
Group.prototype.removeAll = function () {
|
||||
this._tweens = {};
|
||||
};
|
||||
Group.prototype.add = function (tween) {
|
||||
this._tweens[tween.getId()] = tween;
|
||||
this._tweensAddedDuringUpdate[tween.getId()] = tween;
|
||||
};
|
||||
Group.prototype.remove = function (tween) {
|
||||
delete this._tweens[tween.getId()];
|
||||
delete this._tweensAddedDuringUpdate[tween.getId()];
|
||||
};
|
||||
Group.prototype.update = function (time, preserve) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (preserve === void 0) { preserve = false; }
|
||||
var tweenIds = Object.keys(this._tweens);
|
||||
if (tweenIds.length === 0) {
|
||||
return false;
|
||||
}
|
||||
// Tweens are updated in "batches". If you add a new tween during an
|
||||
// update, then the new tween will be updated in the next batch.
|
||||
// If you remove a tween during an update, it may or may not be updated.
|
||||
// However, if the removed tween was added during the current batch,
|
||||
// then it will not be updated.
|
||||
while (tweenIds.length > 0) {
|
||||
this._tweensAddedDuringUpdate = {};
|
||||
for (var i = 0; i < tweenIds.length; i++) {
|
||||
var tween = this._tweens[tweenIds[i]];
|
||||
var autoStart = !preserve;
|
||||
if (tween && tween.update(time, autoStart) === false && !preserve) {
|
||||
delete this._tweens[tweenIds[i]];
|
||||
}
|
||||
}
|
||||
tweenIds = Object.keys(this._tweensAddedDuringUpdate);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
return Group;
|
||||
}());
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var Interpolation = {
|
||||
Linear: function (v, k) {
|
||||
var m = v.length - 1;
|
||||
var f = m * k;
|
||||
var i = Math.floor(f);
|
||||
var fn = Interpolation.Utils.Linear;
|
||||
if (k < 0) {
|
||||
return fn(v[0], v[1], f);
|
||||
}
|
||||
if (k > 1) {
|
||||
return fn(v[m], v[m - 1], m - f);
|
||||
}
|
||||
return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);
|
||||
},
|
||||
Bezier: function (v, k) {
|
||||
var b = 0;
|
||||
var n = v.length - 1;
|
||||
var pw = Math.pow;
|
||||
var bn = Interpolation.Utils.Bernstein;
|
||||
for (var i = 0; i <= n; i++) {
|
||||
b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
|
||||
}
|
||||
return b;
|
||||
},
|
||||
CatmullRom: function (v, k) {
|
||||
var m = v.length - 1;
|
||||
var f = m * k;
|
||||
var i = Math.floor(f);
|
||||
var fn = Interpolation.Utils.CatmullRom;
|
||||
if (v[0] === v[m]) {
|
||||
if (k < 0) {
|
||||
i = Math.floor((f = m * (1 + k)));
|
||||
}
|
||||
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
|
||||
}
|
||||
else {
|
||||
if (k < 0) {
|
||||
return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);
|
||||
}
|
||||
if (k > 1) {
|
||||
return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
|
||||
}
|
||||
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);
|
||||
}
|
||||
},
|
||||
Utils: {
|
||||
Linear: function (p0, p1, t) {
|
||||
return (p1 - p0) * t + p0;
|
||||
},
|
||||
Bernstein: function (n, i) {
|
||||
var fc = Interpolation.Utils.Factorial;
|
||||
return fc(n) / fc(i) / fc(n - i);
|
||||
},
|
||||
Factorial: (function () {
|
||||
var a = [1];
|
||||
return function (n) {
|
||||
var s = 1;
|
||||
if (a[n]) {
|
||||
return a[n];
|
||||
}
|
||||
for (var i = n; i > 1; i--) {
|
||||
s *= i;
|
||||
}
|
||||
a[n] = s;
|
||||
return s;
|
||||
};
|
||||
})(),
|
||||
CatmullRom: function (p0, p1, p2, p3, t) {
|
||||
var v0 = (p2 - p0) * 0.5;
|
||||
var v1 = (p3 - p1) * 0.5;
|
||||
var t2 = t * t;
|
||||
var t3 = t * t2;
|
||||
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Utils
|
||||
*/
|
||||
var Sequence = /** @class */ (function () {
|
||||
function Sequence() {
|
||||
}
|
||||
Sequence.nextId = function () {
|
||||
return Sequence._nextId++;
|
||||
};
|
||||
Sequence._nextId = 0;
|
||||
return Sequence;
|
||||
}());
|
||||
|
||||
var mainGroup = new Group();
|
||||
|
||||
/**
|
||||
* Tween.js - Licensed under the MIT license
|
||||
* https://github.com/tweenjs/tween.js
|
||||
* ----------------------------------------------
|
||||
*
|
||||
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
|
||||
* Thank you all, you're awesome!
|
||||
*/
|
||||
var Tween = /** @class */ (function () {
|
||||
function Tween(_object, _group) {
|
||||
if (_group === void 0) { _group = mainGroup; }
|
||||
this._object = _object;
|
||||
this._group = _group;
|
||||
this._isPaused = false;
|
||||
this._pauseStart = 0;
|
||||
this._valuesStart = {};
|
||||
this._valuesEnd = {};
|
||||
this._valuesStartRepeat = {};
|
||||
this._duration = 1000;
|
||||
this._isDynamic = false;
|
||||
this._initialRepeat = 0;
|
||||
this._repeat = 0;
|
||||
this._yoyo = false;
|
||||
this._isPlaying = false;
|
||||
this._reversed = false;
|
||||
this._delayTime = 0;
|
||||
this._startTime = 0;
|
||||
this._easingFunction = Easing.Linear.None;
|
||||
this._interpolationFunction = Interpolation.Linear;
|
||||
// eslint-disable-next-line
|
||||
this._chainedTweens = [];
|
||||
this._onStartCallbackFired = false;
|
||||
this._onEveryStartCallbackFired = false;
|
||||
this._id = Sequence.nextId();
|
||||
this._isChainStopped = false;
|
||||
this._propertiesAreSetUp = false;
|
||||
this._goToEnd = false;
|
||||
}
|
||||
Tween.prototype.getId = function () {
|
||||
return this._id;
|
||||
};
|
||||
Tween.prototype.isPlaying = function () {
|
||||
return this._isPlaying;
|
||||
};
|
||||
Tween.prototype.isPaused = function () {
|
||||
return this._isPaused;
|
||||
};
|
||||
Tween.prototype.getDuration = function () {
|
||||
return this._duration;
|
||||
};
|
||||
Tween.prototype.to = function (target, duration) {
|
||||
if (duration === void 0) { duration = 1000; }
|
||||
if (this._isPlaying)
|
||||
throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
|
||||
this._valuesEnd = target;
|
||||
this._propertiesAreSetUp = false;
|
||||
this._duration = duration < 0 ? 0 : duration;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.duration = function (duration) {
|
||||
if (duration === void 0) { duration = 1000; }
|
||||
this._duration = duration < 0 ? 0 : duration;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.dynamic = function (dynamic) {
|
||||
if (dynamic === void 0) { dynamic = false; }
|
||||
this._isDynamic = dynamic;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.start = function (time, overrideStartingValues) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (overrideStartingValues === void 0) { overrideStartingValues = false; }
|
||||
if (this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.add(this);
|
||||
this._repeat = this._initialRepeat;
|
||||
if (this._reversed) {
|
||||
// If we were reversed (f.e. using the yoyo feature) then we need to
|
||||
// flip the tween direction back to forward.
|
||||
this._reversed = false;
|
||||
for (var property in this._valuesStartRepeat) {
|
||||
this._swapEndStartRepeatValues(property);
|
||||
this._valuesStart[property] = this._valuesStartRepeat[property];
|
||||
}
|
||||
}
|
||||
this._isPlaying = true;
|
||||
this._isPaused = false;
|
||||
this._onStartCallbackFired = false;
|
||||
this._onEveryStartCallbackFired = false;
|
||||
this._isChainStopped = false;
|
||||
this._startTime = time;
|
||||
this._startTime += this._delayTime;
|
||||
if (!this._propertiesAreSetUp || overrideStartingValues) {
|
||||
this._propertiesAreSetUp = true;
|
||||
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
||||
if (!this._isDynamic) {
|
||||
var tmp = {};
|
||||
for (var prop in this._valuesEnd)
|
||||
tmp[prop] = this._valuesEnd[prop];
|
||||
this._valuesEnd = tmp;
|
||||
}
|
||||
this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.startFromCurrentValues = function (time) {
|
||||
return this.start(time, true);
|
||||
};
|
||||
Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
|
||||
for (var property in _valuesEnd) {
|
||||
var startValue = _object[property];
|
||||
var startValueIsArray = Array.isArray(startValue);
|
||||
var propType = startValueIsArray ? 'array' : typeof startValue;
|
||||
var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]);
|
||||
// If `to()` specifies a property that doesn't exist in the source object,
|
||||
// we should not set that property in the object
|
||||
if (propType === 'undefined' || propType === 'function') {
|
||||
continue;
|
||||
}
|
||||
// Check if an Array was provided as property value
|
||||
if (isInterpolationList) {
|
||||
var endValues = _valuesEnd[property];
|
||||
if (endValues.length === 0) {
|
||||
continue;
|
||||
}
|
||||
// Handle an array of relative values.
|
||||
// Creates a local copy of the Array with the start value at the front
|
||||
var temp = [startValue];
|
||||
for (var i = 0, l = endValues.length; i < l; i += 1) {
|
||||
var value = this._handleRelativeValue(startValue, endValues[i]);
|
||||
if (isNaN(value)) {
|
||||
isInterpolationList = false;
|
||||
console.warn('Found invalid interpolation list. Skipping.');
|
||||
break;
|
||||
}
|
||||
temp.push(value);
|
||||
}
|
||||
if (isInterpolationList) {
|
||||
// if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
|
||||
_valuesEnd[property] = temp;
|
||||
// }
|
||||
}
|
||||
}
|
||||
// handle the deepness of the values
|
||||
if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
|
||||
_valuesStart[property] = startValueIsArray ? [] : {};
|
||||
var nestedObject = startValue;
|
||||
for (var prop in nestedObject) {
|
||||
_valuesStart[property][prop] = nestedObject[prop];
|
||||
}
|
||||
// TODO? repeat nested values? And yoyo? And array values?
|
||||
_valuesStartRepeat[property] = startValueIsArray ? [] : {};
|
||||
var endValues = _valuesEnd[property];
|
||||
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
||||
if (!this._isDynamic) {
|
||||
var tmp = {};
|
||||
for (var prop in endValues)
|
||||
tmp[prop] = endValues[prop];
|
||||
_valuesEnd[property] = endValues = tmp;
|
||||
}
|
||||
this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
|
||||
}
|
||||
else {
|
||||
// Save the starting value, but only once unless override is requested.
|
||||
if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
|
||||
_valuesStart[property] = startValue;
|
||||
}
|
||||
if (!startValueIsArray) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings
|
||||
}
|
||||
if (isInterpolationList) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_valuesStartRepeat[property] = _valuesEnd[property].slice().reverse();
|
||||
}
|
||||
else {
|
||||
_valuesStartRepeat[property] = _valuesStart[property] || 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Tween.prototype.stop = function () {
|
||||
if (!this._isChainStopped) {
|
||||
this._isChainStopped = true;
|
||||
this.stopChainedTweens();
|
||||
}
|
||||
if (!this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.remove(this);
|
||||
this._isPlaying = false;
|
||||
this._isPaused = false;
|
||||
if (this._onStopCallback) {
|
||||
this._onStopCallback(this._object);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.end = function () {
|
||||
this._goToEnd = true;
|
||||
this.update(Infinity);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.pause = function (time) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (this._isPaused || !this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
this._isPaused = true;
|
||||
this._pauseStart = time;
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.remove(this);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.resume = function (time) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (!this._isPaused || !this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
this._isPaused = false;
|
||||
this._startTime += time - this._pauseStart;
|
||||
this._pauseStart = 0;
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.add(this);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.stopChainedTweens = function () {
|
||||
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
||||
this._chainedTweens[i].stop();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.group = function (group) {
|
||||
if (group === void 0) { group = mainGroup; }
|
||||
this._group = group;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.delay = function (amount) {
|
||||
if (amount === void 0) { amount = 0; }
|
||||
this._delayTime = amount;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.repeat = function (times) {
|
||||
if (times === void 0) { times = 0; }
|
||||
this._initialRepeat = times;
|
||||
this._repeat = times;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.repeatDelay = function (amount) {
|
||||
this._repeatDelayTime = amount;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.yoyo = function (yoyo) {
|
||||
if (yoyo === void 0) { yoyo = false; }
|
||||
this._yoyo = yoyo;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.easing = function (easingFunction) {
|
||||
if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
|
||||
this._easingFunction = easingFunction;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.interpolation = function (interpolationFunction) {
|
||||
if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
|
||||
this._interpolationFunction = interpolationFunction;
|
||||
return this;
|
||||
};
|
||||
// eslint-disable-next-line
|
||||
Tween.prototype.chain = function () {
|
||||
var tweens = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
tweens[_i] = arguments[_i];
|
||||
}
|
||||
this._chainedTweens = tweens;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onStart = function (callback) {
|
||||
this._onStartCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onEveryStart = function (callback) {
|
||||
this._onEveryStartCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onUpdate = function (callback) {
|
||||
this._onUpdateCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onRepeat = function (callback) {
|
||||
this._onRepeatCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onComplete = function (callback) {
|
||||
this._onCompleteCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onStop = function (callback) {
|
||||
this._onStopCallback = callback;
|
||||
return this;
|
||||
};
|
||||
/**
|
||||
* @returns true if the tween is still playing after the update, false
|
||||
* otherwise (calling update on a paused tween still returns true because
|
||||
* it is still playing, just paused).
|
||||
*/
|
||||
Tween.prototype.update = function (time, autoStart) {
|
||||
var _this = this;
|
||||
var _a;
|
||||
if (time === void 0) { time = now(); }
|
||||
if (autoStart === void 0) { autoStart = true; }
|
||||
if (this._isPaused)
|
||||
return true;
|
||||
var property;
|
||||
var endTime = this._startTime + this._duration;
|
||||
if (!this._goToEnd && !this._isPlaying) {
|
||||
if (time > endTime)
|
||||
return false;
|
||||
if (autoStart)
|
||||
this.start(time, true);
|
||||
}
|
||||
this._goToEnd = false;
|
||||
if (time < this._startTime) {
|
||||
return true;
|
||||
}
|
||||
if (this._onStartCallbackFired === false) {
|
||||
if (this._onStartCallback) {
|
||||
this._onStartCallback(this._object);
|
||||
}
|
||||
this._onStartCallbackFired = true;
|
||||
}
|
||||
if (this._onEveryStartCallbackFired === false) {
|
||||
if (this._onEveryStartCallback) {
|
||||
this._onEveryStartCallback(this._object);
|
||||
}
|
||||
this._onEveryStartCallbackFired = true;
|
||||
}
|
||||
var elapsedTime = time - this._startTime;
|
||||
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
||||
var totalTime = this._duration + this._repeat * durationAndDelay;
|
||||
var calculateElapsedPortion = function () {
|
||||
if (_this._duration === 0)
|
||||
return 1;
|
||||
if (elapsedTime > totalTime) {
|
||||
return 1;
|
||||
}
|
||||
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
||||
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
||||
// TODO use %?
|
||||
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
||||
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
||||
if (portion === 0 && elapsedTime === _this._duration) {
|
||||
return 1;
|
||||
}
|
||||
return portion;
|
||||
};
|
||||
var elapsed = calculateElapsedPortion();
|
||||
var value = this._easingFunction(elapsed);
|
||||
// properties transformations
|
||||
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
||||
if (this._onUpdateCallback) {
|
||||
this._onUpdateCallback(this._object, elapsed);
|
||||
}
|
||||
if (this._duration === 0 || elapsedTime >= this._duration) {
|
||||
if (this._repeat > 0) {
|
||||
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
||||
if (isFinite(this._repeat)) {
|
||||
this._repeat -= completeCount;
|
||||
}
|
||||
// Reassign starting values, restart by making startTime = now
|
||||
for (property in this._valuesStartRepeat) {
|
||||
if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {
|
||||
this._valuesStartRepeat[property] =
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
|
||||
}
|
||||
if (this._yoyo) {
|
||||
this._swapEndStartRepeatValues(property);
|
||||
}
|
||||
this._valuesStart[property] = this._valuesStartRepeat[property];
|
||||
}
|
||||
if (this._yoyo) {
|
||||
this._reversed = !this._reversed;
|
||||
}
|
||||
this._startTime += durationAndDelay * completeCount;
|
||||
if (this._onRepeatCallback) {
|
||||
this._onRepeatCallback(this._object);
|
||||
}
|
||||
this._onEveryStartCallbackFired = false;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (this._onCompleteCallback) {
|
||||
this._onCompleteCallback(this._object);
|
||||
}
|
||||
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
||||
// Make the chained tweens start exactly at the time they should,
|
||||
// even if the `update()` method was called way past the duration of the tween
|
||||
this._chainedTweens[i].start(this._startTime + this._duration, false);
|
||||
}
|
||||
this._isPlaying = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {
|
||||
for (var property in _valuesEnd) {
|
||||
// Don't update properties that do not exist in the source object
|
||||
if (_valuesStart[property] === undefined) {
|
||||
continue;
|
||||
}
|
||||
var start = _valuesStart[property] || 0;
|
||||
var end = _valuesEnd[property];
|
||||
var startIsArray = Array.isArray(_object[property]);
|
||||
var endIsArray = Array.isArray(end);
|
||||
var isInterpolationList = !startIsArray && endIsArray;
|
||||
if (isInterpolationList) {
|
||||
_object[property] = this._interpolationFunction(end, value);
|
||||
}
|
||||
else if (typeof end === 'object' && end) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
this._updateProperties(_object[property], start, end, value);
|
||||
}
|
||||
else {
|
||||
// Parses relative end values with start as base (e.g.: +10, -3)
|
||||
end = this._handleRelativeValue(start, end);
|
||||
// Protect against non numeric properties.
|
||||
if (typeof end === 'number') {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_object[property] = start + (end - start) * value;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Tween.prototype._handleRelativeValue = function (start, end) {
|
||||
if (typeof end !== 'string') {
|
||||
return end;
|
||||
}
|
||||
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
|
||||
return start + parseFloat(end);
|
||||
}
|
||||
return parseFloat(end);
|
||||
};
|
||||
Tween.prototype._swapEndStartRepeatValues = function (property) {
|
||||
var tmp = this._valuesStartRepeat[property];
|
||||
var endValue = this._valuesEnd[property];
|
||||
if (typeof endValue === 'string') {
|
||||
this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);
|
||||
}
|
||||
else {
|
||||
this._valuesStartRepeat[property] = this._valuesEnd[property];
|
||||
}
|
||||
this._valuesEnd[property] = tmp;
|
||||
};
|
||||
return Tween;
|
||||
}());
|
||||
|
||||
var VERSION = '23.1.3';
|
||||
|
||||
/**
|
||||
* Tween.js - Licensed under the MIT license
|
||||
* https://github.com/tweenjs/tween.js
|
||||
* ----------------------------------------------
|
||||
*
|
||||
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
|
||||
* Thank you all, you're awesome!
|
||||
*/
|
||||
var nextId = Sequence.nextId;
|
||||
/**
|
||||
* Controlling groups of tweens
|
||||
*
|
||||
* Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
|
||||
* In these cases, you may want to create your own smaller groups of tweens.
|
||||
*/
|
||||
var TWEEN = mainGroup;
|
||||
// This is the best way to export things in a way that's compatible with both ES
|
||||
// Modules and CommonJS, without build hacks, and so as not to break the
|
||||
// existing API.
|
||||
// https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
|
||||
var getAll = TWEEN.getAll.bind(TWEEN);
|
||||
var removeAll = TWEEN.removeAll.bind(TWEEN);
|
||||
var add = TWEEN.add.bind(TWEEN);
|
||||
var remove = TWEEN.remove.bind(TWEEN);
|
||||
var update = TWEEN.update.bind(TWEEN);
|
||||
var exports$1 = {
|
||||
Easing: Easing,
|
||||
Group: Group,
|
||||
Interpolation: Interpolation,
|
||||
now: now,
|
||||
Sequence: Sequence,
|
||||
nextId: nextId,
|
||||
Tween: Tween,
|
||||
VERSION: VERSION,
|
||||
getAll: getAll,
|
||||
removeAll: removeAll,
|
||||
add: add,
|
||||
remove: remove,
|
||||
update: update,
|
||||
};
|
||||
|
||||
exports.Easing = Easing;
|
||||
exports.Group = Group;
|
||||
exports.Interpolation = Interpolation;
|
||||
exports.Sequence = Sequence;
|
||||
exports.Tween = Tween;
|
||||
exports.VERSION = VERSION;
|
||||
exports.add = add;
|
||||
exports.default = exports$1;
|
||||
exports.getAll = getAll;
|
||||
exports.nextId = nextId;
|
||||
exports.now = now;
|
||||
exports.remove = remove;
|
||||
exports.removeAll = removeAll;
|
||||
exports.update = update;
|
||||
206
web-app/node_modules/@tweenjs/tween.js/dist/tween.d.ts
generated
vendored
Normal file
206
web-app/node_modules/@tweenjs/tween.js/dist/tween.d.ts
generated
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
type EasingFunction = (amount: number) => number;
|
||||
type EasingFunctionGroup = {
|
||||
In: EasingFunction;
|
||||
Out: EasingFunction;
|
||||
InOut: EasingFunction;
|
||||
};
|
||||
/**
|
||||
* The Ease class provides a collection of easing functions for use with tween.js.
|
||||
*/
|
||||
declare const Easing: Readonly<{
|
||||
Linear: Readonly<EasingFunctionGroup & {
|
||||
None: EasingFunction;
|
||||
}>;
|
||||
Quadratic: Readonly<EasingFunctionGroup>;
|
||||
Cubic: Readonly<EasingFunctionGroup>;
|
||||
Quartic: Readonly<EasingFunctionGroup>;
|
||||
Quintic: Readonly<EasingFunctionGroup>;
|
||||
Sinusoidal: Readonly<EasingFunctionGroup>;
|
||||
Exponential: Readonly<EasingFunctionGroup>;
|
||||
Circular: Readonly<EasingFunctionGroup>;
|
||||
Elastic: Readonly<EasingFunctionGroup>;
|
||||
Back: Readonly<EasingFunctionGroup>;
|
||||
Bounce: Readonly<EasingFunctionGroup>;
|
||||
generatePow(power?: number): EasingFunctionGroup;
|
||||
}>;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
type InterpolationFunction = (v: number[], k: number) => number;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
declare const Interpolation: {
|
||||
Linear: (v: number[], k: number) => number;
|
||||
Bezier: (v: number[], k: number) => number;
|
||||
CatmullRom: (v: number[], k: number) => number;
|
||||
Utils: {
|
||||
Linear: (p0: number, p1: number, t: number) => number;
|
||||
Bernstein: (n: number, i: number) => number;
|
||||
Factorial: (n: number) => number;
|
||||
CatmullRom: (p0: number, p1: number, p2: number, p3: number, t: number) => number;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Controlling groups of tweens
|
||||
*
|
||||
* Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
|
||||
* In these cases, you may want to create your own smaller groups of tween
|
||||
*/
|
||||
declare class Group {
|
||||
private _tweens;
|
||||
private _tweensAddedDuringUpdate;
|
||||
getAll(): Array<Tween<UnknownProps>>;
|
||||
removeAll(): void;
|
||||
add(tween: Tween<UnknownProps>): void;
|
||||
remove(tween: Tween<UnknownProps>): void;
|
||||
update(time?: number, preserve?: boolean): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tween.js - Licensed under the MIT license
|
||||
* https://github.com/tweenjs/tween.js
|
||||
* ----------------------------------------------
|
||||
*
|
||||
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
|
||||
* Thank you all, you're awesome!
|
||||
*/
|
||||
|
||||
declare class Tween<T extends UnknownProps> {
|
||||
private _object;
|
||||
private _group;
|
||||
private _isPaused;
|
||||
private _pauseStart;
|
||||
private _valuesStart;
|
||||
private _valuesEnd;
|
||||
private _valuesStartRepeat;
|
||||
private _duration;
|
||||
private _isDynamic;
|
||||
private _initialRepeat;
|
||||
private _repeat;
|
||||
private _repeatDelayTime?;
|
||||
private _yoyo;
|
||||
private _isPlaying;
|
||||
private _reversed;
|
||||
private _delayTime;
|
||||
private _startTime;
|
||||
private _easingFunction;
|
||||
private _interpolationFunction;
|
||||
private _chainedTweens;
|
||||
private _onStartCallback?;
|
||||
private _onStartCallbackFired;
|
||||
private _onEveryStartCallback?;
|
||||
private _onEveryStartCallbackFired;
|
||||
private _onUpdateCallback?;
|
||||
private _onRepeatCallback?;
|
||||
private _onCompleteCallback?;
|
||||
private _onStopCallback?;
|
||||
private _id;
|
||||
private _isChainStopped;
|
||||
private _propertiesAreSetUp;
|
||||
constructor(_object: T, _group?: Group | false);
|
||||
getId(): number;
|
||||
isPlaying(): boolean;
|
||||
isPaused(): boolean;
|
||||
getDuration(): number;
|
||||
to(target: UnknownProps, duration?: number): this;
|
||||
duration(duration?: number): this;
|
||||
dynamic(dynamic?: boolean): this;
|
||||
start(time?: number, overrideStartingValues?: boolean): this;
|
||||
startFromCurrentValues(time?: number): this;
|
||||
private _setupProperties;
|
||||
stop(): this;
|
||||
end(): this;
|
||||
pause(time?: number): this;
|
||||
resume(time?: number): this;
|
||||
stopChainedTweens(): this;
|
||||
group(group?: Group): this;
|
||||
delay(amount?: number): this;
|
||||
repeat(times?: number): this;
|
||||
repeatDelay(amount?: number): this;
|
||||
yoyo(yoyo?: boolean): this;
|
||||
easing(easingFunction?: EasingFunction): this;
|
||||
interpolation(interpolationFunction?: InterpolationFunction): this;
|
||||
chain(...tweens: Array<Tween<any>>): this;
|
||||
onStart(callback?: (object: T) => void): this;
|
||||
onEveryStart(callback?: (object: T) => void): this;
|
||||
onUpdate(callback?: (object: T, elapsed: number) => void): this;
|
||||
onRepeat(callback?: (object: T) => void): this;
|
||||
onComplete(callback?: (object: T) => void): this;
|
||||
onStop(callback?: (object: T) => void): this;
|
||||
private _goToEnd;
|
||||
/**
|
||||
* @returns true if the tween is still playing after the update, false
|
||||
* otherwise (calling update on a paused tween still returns true because
|
||||
* it is still playing, just paused).
|
||||
*/
|
||||
update(time?: number, autoStart?: boolean): boolean;
|
||||
private _updateProperties;
|
||||
private _handleRelativeValue;
|
||||
private _swapEndStartRepeatValues;
|
||||
}
|
||||
type UnknownProps = Record<string, any>;
|
||||
|
||||
declare const now: () => number;
|
||||
|
||||
/**
|
||||
* Utils
|
||||
*/
|
||||
declare class Sequence {
|
||||
private static _nextId;
|
||||
static nextId(): number;
|
||||
}
|
||||
|
||||
declare const VERSION = "23.1.3";
|
||||
|
||||
declare const nextId: typeof Sequence.nextId;
|
||||
declare const getAll: () => Tween<UnknownProps>[];
|
||||
declare const removeAll: () => void;
|
||||
declare const add: (tween: Tween<UnknownProps>) => void;
|
||||
declare const remove: (tween: Tween<UnknownProps>) => void;
|
||||
declare const update: (time?: number, preserve?: boolean) => boolean;
|
||||
|
||||
declare const exports: {
|
||||
Easing: Readonly<{
|
||||
Linear: Readonly<EasingFunctionGroup & {
|
||||
None: EasingFunction;
|
||||
}>;
|
||||
Quadratic: Readonly<EasingFunctionGroup>;
|
||||
Cubic: Readonly<EasingFunctionGroup>;
|
||||
Quartic: Readonly<EasingFunctionGroup>;
|
||||
Quintic: Readonly<EasingFunctionGroup>;
|
||||
Sinusoidal: Readonly<EasingFunctionGroup>;
|
||||
Exponential: Readonly<EasingFunctionGroup>;
|
||||
Circular: Readonly<EasingFunctionGroup>;
|
||||
Elastic: Readonly<EasingFunctionGroup>;
|
||||
Back: Readonly<EasingFunctionGroup>;
|
||||
Bounce: Readonly<EasingFunctionGroup>;
|
||||
generatePow(power?: number): EasingFunctionGroup;
|
||||
}>;
|
||||
Group: typeof Group;
|
||||
Interpolation: {
|
||||
Linear: (v: number[], k: number) => number;
|
||||
Bezier: (v: number[], k: number) => number;
|
||||
CatmullRom: (v: number[], k: number) => number;
|
||||
Utils: {
|
||||
Linear: (p0: number, p1: number, t: number) => number;
|
||||
Bernstein: (n: number, i: number) => number;
|
||||
Factorial: (n: number) => number;
|
||||
CatmullRom: (p0: number, p1: number, p2: number, p3: number, t: number) => number;
|
||||
};
|
||||
};
|
||||
now: () => number;
|
||||
Sequence: typeof Sequence;
|
||||
nextId: typeof Sequence.nextId;
|
||||
Tween: typeof Tween;
|
||||
VERSION: string;
|
||||
getAll: () => Tween<UnknownProps>[];
|
||||
removeAll: () => void;
|
||||
add: (tween: Tween<UnknownProps>) => void;
|
||||
remove: (tween: Tween<UnknownProps>) => void;
|
||||
update: (time?: number, preserve?: boolean) => boolean;
|
||||
};
|
||||
|
||||
export { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, exports as default, getAll, nextId, now, remove, removeAll, update };
|
||||
876
web-app/node_modules/@tweenjs/tween.js/dist/tween.esm.js
generated
vendored
Normal file
876
web-app/node_modules/@tweenjs/tween.js/dist/tween.esm.js
generated
vendored
Normal file
@@ -0,0 +1,876 @@
|
||||
/**
|
||||
* The Ease class provides a collection of easing functions for use with tween.js.
|
||||
*/
|
||||
var Easing = Object.freeze({
|
||||
Linear: Object.freeze({
|
||||
None: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
In: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
}),
|
||||
Quadratic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount * (2 - amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount;
|
||||
}
|
||||
return -0.5 * (--amount * (amount - 2) - 1);
|
||||
},
|
||||
}),
|
||||
Cubic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return --amount * amount * amount + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount;
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * amount + 2);
|
||||
},
|
||||
}),
|
||||
Quartic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return 1 - --amount * amount * amount * amount;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount * amount;
|
||||
}
|
||||
return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
|
||||
},
|
||||
}),
|
||||
Quintic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return --amount * amount * amount * amount * amount + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount * amount * amount;
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
|
||||
},
|
||||
}),
|
||||
Sinusoidal: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return Math.sin((amount * Math.PI) / 2);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
|
||||
},
|
||||
}),
|
||||
Exponential: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount === 0 ? 0 : Math.pow(1024, amount - 1);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * Math.pow(1024, amount - 1);
|
||||
}
|
||||
return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
|
||||
},
|
||||
}),
|
||||
Circular: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Math.sqrt(1 - amount * amount);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return Math.sqrt(1 - --amount * amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return -0.5 * (Math.sqrt(1 - amount * amount) - 1);
|
||||
}
|
||||
return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
|
||||
},
|
||||
}),
|
||||
Elastic: Object.freeze({
|
||||
In: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
|
||||
},
|
||||
Out: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
amount *= 2;
|
||||
if (amount < 1) {
|
||||
return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
|
||||
}
|
||||
return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
|
||||
},
|
||||
}),
|
||||
Back: Object.freeze({
|
||||
In: function (amount) {
|
||||
var s = 1.70158;
|
||||
return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
|
||||
},
|
||||
Out: function (amount) {
|
||||
var s = 1.70158;
|
||||
return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
var s = 1.70158 * 1.525;
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * (amount * amount * ((s + 1) * amount - s));
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
|
||||
},
|
||||
}),
|
||||
Bounce: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Easing.Bounce.Out(1 - amount);
|
||||
},
|
||||
Out: function (amount) {
|
||||
if (amount < 1 / 2.75) {
|
||||
return 7.5625 * amount * amount;
|
||||
}
|
||||
else if (amount < 2 / 2.75) {
|
||||
return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;
|
||||
}
|
||||
else if (amount < 2.5 / 2.75) {
|
||||
return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;
|
||||
}
|
||||
else {
|
||||
return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;
|
||||
}
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount < 0.5) {
|
||||
return Easing.Bounce.In(amount * 2) * 0.5;
|
||||
}
|
||||
return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
|
||||
},
|
||||
}),
|
||||
generatePow: function (power) {
|
||||
if (power === void 0) { power = 4; }
|
||||
power = power < Number.EPSILON ? Number.EPSILON : power;
|
||||
power = power > 10000 ? 10000 : power;
|
||||
return {
|
||||
In: function (amount) {
|
||||
return Math.pow(amount, power);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return 1 - Math.pow((1 - amount), power);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount < 0.5) {
|
||||
return Math.pow((amount * 2), power) / 2;
|
||||
}
|
||||
return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
var now = function () { return performance.now(); };
|
||||
|
||||
/**
|
||||
* Controlling groups of tweens
|
||||
*
|
||||
* Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
|
||||
* In these cases, you may want to create your own smaller groups of tween
|
||||
*/
|
||||
var Group = /** @class */ (function () {
|
||||
function Group() {
|
||||
this._tweens = {};
|
||||
this._tweensAddedDuringUpdate = {};
|
||||
}
|
||||
Group.prototype.getAll = function () {
|
||||
var _this = this;
|
||||
return Object.keys(this._tweens).map(function (tweenId) {
|
||||
return _this._tweens[tweenId];
|
||||
});
|
||||
};
|
||||
Group.prototype.removeAll = function () {
|
||||
this._tweens = {};
|
||||
};
|
||||
Group.prototype.add = function (tween) {
|
||||
this._tweens[tween.getId()] = tween;
|
||||
this._tweensAddedDuringUpdate[tween.getId()] = tween;
|
||||
};
|
||||
Group.prototype.remove = function (tween) {
|
||||
delete this._tweens[tween.getId()];
|
||||
delete this._tweensAddedDuringUpdate[tween.getId()];
|
||||
};
|
||||
Group.prototype.update = function (time, preserve) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (preserve === void 0) { preserve = false; }
|
||||
var tweenIds = Object.keys(this._tweens);
|
||||
if (tweenIds.length === 0) {
|
||||
return false;
|
||||
}
|
||||
// Tweens are updated in "batches". If you add a new tween during an
|
||||
// update, then the new tween will be updated in the next batch.
|
||||
// If you remove a tween during an update, it may or may not be updated.
|
||||
// However, if the removed tween was added during the current batch,
|
||||
// then it will not be updated.
|
||||
while (tweenIds.length > 0) {
|
||||
this._tweensAddedDuringUpdate = {};
|
||||
for (var i = 0; i < tweenIds.length; i++) {
|
||||
var tween = this._tweens[tweenIds[i]];
|
||||
var autoStart = !preserve;
|
||||
if (tween && tween.update(time, autoStart) === false && !preserve) {
|
||||
delete this._tweens[tweenIds[i]];
|
||||
}
|
||||
}
|
||||
tweenIds = Object.keys(this._tweensAddedDuringUpdate);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
return Group;
|
||||
}());
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var Interpolation = {
|
||||
Linear: function (v, k) {
|
||||
var m = v.length - 1;
|
||||
var f = m * k;
|
||||
var i = Math.floor(f);
|
||||
var fn = Interpolation.Utils.Linear;
|
||||
if (k < 0) {
|
||||
return fn(v[0], v[1], f);
|
||||
}
|
||||
if (k > 1) {
|
||||
return fn(v[m], v[m - 1], m - f);
|
||||
}
|
||||
return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);
|
||||
},
|
||||
Bezier: function (v, k) {
|
||||
var b = 0;
|
||||
var n = v.length - 1;
|
||||
var pw = Math.pow;
|
||||
var bn = Interpolation.Utils.Bernstein;
|
||||
for (var i = 0; i <= n; i++) {
|
||||
b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
|
||||
}
|
||||
return b;
|
||||
},
|
||||
CatmullRom: function (v, k) {
|
||||
var m = v.length - 1;
|
||||
var f = m * k;
|
||||
var i = Math.floor(f);
|
||||
var fn = Interpolation.Utils.CatmullRom;
|
||||
if (v[0] === v[m]) {
|
||||
if (k < 0) {
|
||||
i = Math.floor((f = m * (1 + k)));
|
||||
}
|
||||
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
|
||||
}
|
||||
else {
|
||||
if (k < 0) {
|
||||
return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);
|
||||
}
|
||||
if (k > 1) {
|
||||
return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
|
||||
}
|
||||
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);
|
||||
}
|
||||
},
|
||||
Utils: {
|
||||
Linear: function (p0, p1, t) {
|
||||
return (p1 - p0) * t + p0;
|
||||
},
|
||||
Bernstein: function (n, i) {
|
||||
var fc = Interpolation.Utils.Factorial;
|
||||
return fc(n) / fc(i) / fc(n - i);
|
||||
},
|
||||
Factorial: (function () {
|
||||
var a = [1];
|
||||
return function (n) {
|
||||
var s = 1;
|
||||
if (a[n]) {
|
||||
return a[n];
|
||||
}
|
||||
for (var i = n; i > 1; i--) {
|
||||
s *= i;
|
||||
}
|
||||
a[n] = s;
|
||||
return s;
|
||||
};
|
||||
})(),
|
||||
CatmullRom: function (p0, p1, p2, p3, t) {
|
||||
var v0 = (p2 - p0) * 0.5;
|
||||
var v1 = (p3 - p1) * 0.5;
|
||||
var t2 = t * t;
|
||||
var t3 = t * t2;
|
||||
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Utils
|
||||
*/
|
||||
var Sequence = /** @class */ (function () {
|
||||
function Sequence() {
|
||||
}
|
||||
Sequence.nextId = function () {
|
||||
return Sequence._nextId++;
|
||||
};
|
||||
Sequence._nextId = 0;
|
||||
return Sequence;
|
||||
}());
|
||||
|
||||
var mainGroup = new Group();
|
||||
|
||||
/**
|
||||
* Tween.js - Licensed under the MIT license
|
||||
* https://github.com/tweenjs/tween.js
|
||||
* ----------------------------------------------
|
||||
*
|
||||
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
|
||||
* Thank you all, you're awesome!
|
||||
*/
|
||||
var Tween = /** @class */ (function () {
|
||||
function Tween(_object, _group) {
|
||||
if (_group === void 0) { _group = mainGroup; }
|
||||
this._object = _object;
|
||||
this._group = _group;
|
||||
this._isPaused = false;
|
||||
this._pauseStart = 0;
|
||||
this._valuesStart = {};
|
||||
this._valuesEnd = {};
|
||||
this._valuesStartRepeat = {};
|
||||
this._duration = 1000;
|
||||
this._isDynamic = false;
|
||||
this._initialRepeat = 0;
|
||||
this._repeat = 0;
|
||||
this._yoyo = false;
|
||||
this._isPlaying = false;
|
||||
this._reversed = false;
|
||||
this._delayTime = 0;
|
||||
this._startTime = 0;
|
||||
this._easingFunction = Easing.Linear.None;
|
||||
this._interpolationFunction = Interpolation.Linear;
|
||||
// eslint-disable-next-line
|
||||
this._chainedTweens = [];
|
||||
this._onStartCallbackFired = false;
|
||||
this._onEveryStartCallbackFired = false;
|
||||
this._id = Sequence.nextId();
|
||||
this._isChainStopped = false;
|
||||
this._propertiesAreSetUp = false;
|
||||
this._goToEnd = false;
|
||||
}
|
||||
Tween.prototype.getId = function () {
|
||||
return this._id;
|
||||
};
|
||||
Tween.prototype.isPlaying = function () {
|
||||
return this._isPlaying;
|
||||
};
|
||||
Tween.prototype.isPaused = function () {
|
||||
return this._isPaused;
|
||||
};
|
||||
Tween.prototype.getDuration = function () {
|
||||
return this._duration;
|
||||
};
|
||||
Tween.prototype.to = function (target, duration) {
|
||||
if (duration === void 0) { duration = 1000; }
|
||||
if (this._isPlaying)
|
||||
throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
|
||||
this._valuesEnd = target;
|
||||
this._propertiesAreSetUp = false;
|
||||
this._duration = duration < 0 ? 0 : duration;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.duration = function (duration) {
|
||||
if (duration === void 0) { duration = 1000; }
|
||||
this._duration = duration < 0 ? 0 : duration;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.dynamic = function (dynamic) {
|
||||
if (dynamic === void 0) { dynamic = false; }
|
||||
this._isDynamic = dynamic;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.start = function (time, overrideStartingValues) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (overrideStartingValues === void 0) { overrideStartingValues = false; }
|
||||
if (this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.add(this);
|
||||
this._repeat = this._initialRepeat;
|
||||
if (this._reversed) {
|
||||
// If we were reversed (f.e. using the yoyo feature) then we need to
|
||||
// flip the tween direction back to forward.
|
||||
this._reversed = false;
|
||||
for (var property in this._valuesStartRepeat) {
|
||||
this._swapEndStartRepeatValues(property);
|
||||
this._valuesStart[property] = this._valuesStartRepeat[property];
|
||||
}
|
||||
}
|
||||
this._isPlaying = true;
|
||||
this._isPaused = false;
|
||||
this._onStartCallbackFired = false;
|
||||
this._onEveryStartCallbackFired = false;
|
||||
this._isChainStopped = false;
|
||||
this._startTime = time;
|
||||
this._startTime += this._delayTime;
|
||||
if (!this._propertiesAreSetUp || overrideStartingValues) {
|
||||
this._propertiesAreSetUp = true;
|
||||
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
||||
if (!this._isDynamic) {
|
||||
var tmp = {};
|
||||
for (var prop in this._valuesEnd)
|
||||
tmp[prop] = this._valuesEnd[prop];
|
||||
this._valuesEnd = tmp;
|
||||
}
|
||||
this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.startFromCurrentValues = function (time) {
|
||||
return this.start(time, true);
|
||||
};
|
||||
Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
|
||||
for (var property in _valuesEnd) {
|
||||
var startValue = _object[property];
|
||||
var startValueIsArray = Array.isArray(startValue);
|
||||
var propType = startValueIsArray ? 'array' : typeof startValue;
|
||||
var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]);
|
||||
// If `to()` specifies a property that doesn't exist in the source object,
|
||||
// we should not set that property in the object
|
||||
if (propType === 'undefined' || propType === 'function') {
|
||||
continue;
|
||||
}
|
||||
// Check if an Array was provided as property value
|
||||
if (isInterpolationList) {
|
||||
var endValues = _valuesEnd[property];
|
||||
if (endValues.length === 0) {
|
||||
continue;
|
||||
}
|
||||
// Handle an array of relative values.
|
||||
// Creates a local copy of the Array with the start value at the front
|
||||
var temp = [startValue];
|
||||
for (var i = 0, l = endValues.length; i < l; i += 1) {
|
||||
var value = this._handleRelativeValue(startValue, endValues[i]);
|
||||
if (isNaN(value)) {
|
||||
isInterpolationList = false;
|
||||
console.warn('Found invalid interpolation list. Skipping.');
|
||||
break;
|
||||
}
|
||||
temp.push(value);
|
||||
}
|
||||
if (isInterpolationList) {
|
||||
// if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
|
||||
_valuesEnd[property] = temp;
|
||||
// }
|
||||
}
|
||||
}
|
||||
// handle the deepness of the values
|
||||
if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
|
||||
_valuesStart[property] = startValueIsArray ? [] : {};
|
||||
var nestedObject = startValue;
|
||||
for (var prop in nestedObject) {
|
||||
_valuesStart[property][prop] = nestedObject[prop];
|
||||
}
|
||||
// TODO? repeat nested values? And yoyo? And array values?
|
||||
_valuesStartRepeat[property] = startValueIsArray ? [] : {};
|
||||
var endValues = _valuesEnd[property];
|
||||
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
||||
if (!this._isDynamic) {
|
||||
var tmp = {};
|
||||
for (var prop in endValues)
|
||||
tmp[prop] = endValues[prop];
|
||||
_valuesEnd[property] = endValues = tmp;
|
||||
}
|
||||
this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
|
||||
}
|
||||
else {
|
||||
// Save the starting value, but only once unless override is requested.
|
||||
if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
|
||||
_valuesStart[property] = startValue;
|
||||
}
|
||||
if (!startValueIsArray) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings
|
||||
}
|
||||
if (isInterpolationList) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_valuesStartRepeat[property] = _valuesEnd[property].slice().reverse();
|
||||
}
|
||||
else {
|
||||
_valuesStartRepeat[property] = _valuesStart[property] || 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Tween.prototype.stop = function () {
|
||||
if (!this._isChainStopped) {
|
||||
this._isChainStopped = true;
|
||||
this.stopChainedTweens();
|
||||
}
|
||||
if (!this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.remove(this);
|
||||
this._isPlaying = false;
|
||||
this._isPaused = false;
|
||||
if (this._onStopCallback) {
|
||||
this._onStopCallback(this._object);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.end = function () {
|
||||
this._goToEnd = true;
|
||||
this.update(Infinity);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.pause = function (time) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (this._isPaused || !this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
this._isPaused = true;
|
||||
this._pauseStart = time;
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.remove(this);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.resume = function (time) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (!this._isPaused || !this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
this._isPaused = false;
|
||||
this._startTime += time - this._pauseStart;
|
||||
this._pauseStart = 0;
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.add(this);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.stopChainedTweens = function () {
|
||||
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
||||
this._chainedTweens[i].stop();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.group = function (group) {
|
||||
if (group === void 0) { group = mainGroup; }
|
||||
this._group = group;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.delay = function (amount) {
|
||||
if (amount === void 0) { amount = 0; }
|
||||
this._delayTime = amount;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.repeat = function (times) {
|
||||
if (times === void 0) { times = 0; }
|
||||
this._initialRepeat = times;
|
||||
this._repeat = times;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.repeatDelay = function (amount) {
|
||||
this._repeatDelayTime = amount;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.yoyo = function (yoyo) {
|
||||
if (yoyo === void 0) { yoyo = false; }
|
||||
this._yoyo = yoyo;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.easing = function (easingFunction) {
|
||||
if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
|
||||
this._easingFunction = easingFunction;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.interpolation = function (interpolationFunction) {
|
||||
if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
|
||||
this._interpolationFunction = interpolationFunction;
|
||||
return this;
|
||||
};
|
||||
// eslint-disable-next-line
|
||||
Tween.prototype.chain = function () {
|
||||
var tweens = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
tweens[_i] = arguments[_i];
|
||||
}
|
||||
this._chainedTweens = tweens;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onStart = function (callback) {
|
||||
this._onStartCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onEveryStart = function (callback) {
|
||||
this._onEveryStartCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onUpdate = function (callback) {
|
||||
this._onUpdateCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onRepeat = function (callback) {
|
||||
this._onRepeatCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onComplete = function (callback) {
|
||||
this._onCompleteCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onStop = function (callback) {
|
||||
this._onStopCallback = callback;
|
||||
return this;
|
||||
};
|
||||
/**
|
||||
* @returns true if the tween is still playing after the update, false
|
||||
* otherwise (calling update on a paused tween still returns true because
|
||||
* it is still playing, just paused).
|
||||
*/
|
||||
Tween.prototype.update = function (time, autoStart) {
|
||||
var _this = this;
|
||||
var _a;
|
||||
if (time === void 0) { time = now(); }
|
||||
if (autoStart === void 0) { autoStart = true; }
|
||||
if (this._isPaused)
|
||||
return true;
|
||||
var property;
|
||||
var endTime = this._startTime + this._duration;
|
||||
if (!this._goToEnd && !this._isPlaying) {
|
||||
if (time > endTime)
|
||||
return false;
|
||||
if (autoStart)
|
||||
this.start(time, true);
|
||||
}
|
||||
this._goToEnd = false;
|
||||
if (time < this._startTime) {
|
||||
return true;
|
||||
}
|
||||
if (this._onStartCallbackFired === false) {
|
||||
if (this._onStartCallback) {
|
||||
this._onStartCallback(this._object);
|
||||
}
|
||||
this._onStartCallbackFired = true;
|
||||
}
|
||||
if (this._onEveryStartCallbackFired === false) {
|
||||
if (this._onEveryStartCallback) {
|
||||
this._onEveryStartCallback(this._object);
|
||||
}
|
||||
this._onEveryStartCallbackFired = true;
|
||||
}
|
||||
var elapsedTime = time - this._startTime;
|
||||
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
||||
var totalTime = this._duration + this._repeat * durationAndDelay;
|
||||
var calculateElapsedPortion = function () {
|
||||
if (_this._duration === 0)
|
||||
return 1;
|
||||
if (elapsedTime > totalTime) {
|
||||
return 1;
|
||||
}
|
||||
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
||||
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
||||
// TODO use %?
|
||||
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
||||
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
||||
if (portion === 0 && elapsedTime === _this._duration) {
|
||||
return 1;
|
||||
}
|
||||
return portion;
|
||||
};
|
||||
var elapsed = calculateElapsedPortion();
|
||||
var value = this._easingFunction(elapsed);
|
||||
// properties transformations
|
||||
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
||||
if (this._onUpdateCallback) {
|
||||
this._onUpdateCallback(this._object, elapsed);
|
||||
}
|
||||
if (this._duration === 0 || elapsedTime >= this._duration) {
|
||||
if (this._repeat > 0) {
|
||||
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
||||
if (isFinite(this._repeat)) {
|
||||
this._repeat -= completeCount;
|
||||
}
|
||||
// Reassign starting values, restart by making startTime = now
|
||||
for (property in this._valuesStartRepeat) {
|
||||
if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {
|
||||
this._valuesStartRepeat[property] =
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
|
||||
}
|
||||
if (this._yoyo) {
|
||||
this._swapEndStartRepeatValues(property);
|
||||
}
|
||||
this._valuesStart[property] = this._valuesStartRepeat[property];
|
||||
}
|
||||
if (this._yoyo) {
|
||||
this._reversed = !this._reversed;
|
||||
}
|
||||
this._startTime += durationAndDelay * completeCount;
|
||||
if (this._onRepeatCallback) {
|
||||
this._onRepeatCallback(this._object);
|
||||
}
|
||||
this._onEveryStartCallbackFired = false;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (this._onCompleteCallback) {
|
||||
this._onCompleteCallback(this._object);
|
||||
}
|
||||
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
||||
// Make the chained tweens start exactly at the time they should,
|
||||
// even if the `update()` method was called way past the duration of the tween
|
||||
this._chainedTweens[i].start(this._startTime + this._duration, false);
|
||||
}
|
||||
this._isPlaying = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {
|
||||
for (var property in _valuesEnd) {
|
||||
// Don't update properties that do not exist in the source object
|
||||
if (_valuesStart[property] === undefined) {
|
||||
continue;
|
||||
}
|
||||
var start = _valuesStart[property] || 0;
|
||||
var end = _valuesEnd[property];
|
||||
var startIsArray = Array.isArray(_object[property]);
|
||||
var endIsArray = Array.isArray(end);
|
||||
var isInterpolationList = !startIsArray && endIsArray;
|
||||
if (isInterpolationList) {
|
||||
_object[property] = this._interpolationFunction(end, value);
|
||||
}
|
||||
else if (typeof end === 'object' && end) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
this._updateProperties(_object[property], start, end, value);
|
||||
}
|
||||
else {
|
||||
// Parses relative end values with start as base (e.g.: +10, -3)
|
||||
end = this._handleRelativeValue(start, end);
|
||||
// Protect against non numeric properties.
|
||||
if (typeof end === 'number') {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_object[property] = start + (end - start) * value;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Tween.prototype._handleRelativeValue = function (start, end) {
|
||||
if (typeof end !== 'string') {
|
||||
return end;
|
||||
}
|
||||
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
|
||||
return start + parseFloat(end);
|
||||
}
|
||||
return parseFloat(end);
|
||||
};
|
||||
Tween.prototype._swapEndStartRepeatValues = function (property) {
|
||||
var tmp = this._valuesStartRepeat[property];
|
||||
var endValue = this._valuesEnd[property];
|
||||
if (typeof endValue === 'string') {
|
||||
this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);
|
||||
}
|
||||
else {
|
||||
this._valuesStartRepeat[property] = this._valuesEnd[property];
|
||||
}
|
||||
this._valuesEnd[property] = tmp;
|
||||
};
|
||||
return Tween;
|
||||
}());
|
||||
|
||||
var VERSION = '23.1.3';
|
||||
|
||||
/**
|
||||
* Tween.js - Licensed under the MIT license
|
||||
* https://github.com/tweenjs/tween.js
|
||||
* ----------------------------------------------
|
||||
*
|
||||
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
|
||||
* Thank you all, you're awesome!
|
||||
*/
|
||||
var nextId = Sequence.nextId;
|
||||
/**
|
||||
* Controlling groups of tweens
|
||||
*
|
||||
* Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
|
||||
* In these cases, you may want to create your own smaller groups of tweens.
|
||||
*/
|
||||
var TWEEN = mainGroup;
|
||||
// This is the best way to export things in a way that's compatible with both ES
|
||||
// Modules and CommonJS, without build hacks, and so as not to break the
|
||||
// existing API.
|
||||
// https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
|
||||
var getAll = TWEEN.getAll.bind(TWEEN);
|
||||
var removeAll = TWEEN.removeAll.bind(TWEEN);
|
||||
var add = TWEEN.add.bind(TWEEN);
|
||||
var remove = TWEEN.remove.bind(TWEEN);
|
||||
var update = TWEEN.update.bind(TWEEN);
|
||||
var exports = {
|
||||
Easing: Easing,
|
||||
Group: Group,
|
||||
Interpolation: Interpolation,
|
||||
now: now,
|
||||
Sequence: Sequence,
|
||||
nextId: nextId,
|
||||
Tween: Tween,
|
||||
VERSION: VERSION,
|
||||
getAll: getAll,
|
||||
removeAll: removeAll,
|
||||
add: add,
|
||||
remove: remove,
|
||||
update: update,
|
||||
};
|
||||
|
||||
export { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, exports as default, getAll, nextId, now, remove, removeAll, update };
|
||||
899
web-app/node_modules/@tweenjs/tween.js/dist/tween.umd.js
generated
vendored
Normal file
899
web-app/node_modules/@tweenjs/tween.js/dist/tween.umd.js
generated
vendored
Normal file
@@ -0,0 +1,899 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TWEEN = {}));
|
||||
})(this, (function (exports) { 'use strict';
|
||||
|
||||
/**
|
||||
* The Ease class provides a collection of easing functions for use with tween.js.
|
||||
*/
|
||||
var Easing = Object.freeze({
|
||||
Linear: Object.freeze({
|
||||
None: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
In: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
return amount;
|
||||
},
|
||||
}),
|
||||
Quadratic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount * (2 - amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount;
|
||||
}
|
||||
return -0.5 * (--amount * (amount - 2) - 1);
|
||||
},
|
||||
}),
|
||||
Cubic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return --amount * amount * amount + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount;
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * amount + 2);
|
||||
},
|
||||
}),
|
||||
Quartic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return 1 - --amount * amount * amount * amount;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount * amount;
|
||||
}
|
||||
return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
|
||||
},
|
||||
}),
|
||||
Quintic: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount * amount * amount * amount * amount;
|
||||
},
|
||||
Out: function (amount) {
|
||||
return --amount * amount * amount * amount * amount + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * amount * amount * amount * amount * amount;
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
|
||||
},
|
||||
}),
|
||||
Sinusoidal: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return Math.sin((amount * Math.PI) / 2);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
|
||||
},
|
||||
}),
|
||||
Exponential: Object.freeze({
|
||||
In: function (amount) {
|
||||
return amount === 0 ? 0 : Math.pow(1024, amount - 1);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * Math.pow(1024, amount - 1);
|
||||
}
|
||||
return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
|
||||
},
|
||||
}),
|
||||
Circular: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Math.sqrt(1 - amount * amount);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return Math.sqrt(1 - --amount * amount);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if ((amount *= 2) < 1) {
|
||||
return -0.5 * (Math.sqrt(1 - amount * amount) - 1);
|
||||
}
|
||||
return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
|
||||
},
|
||||
}),
|
||||
Elastic: Object.freeze({
|
||||
In: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
|
||||
},
|
||||
Out: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount === 1) {
|
||||
return 1;
|
||||
}
|
||||
amount *= 2;
|
||||
if (amount < 1) {
|
||||
return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
|
||||
}
|
||||
return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
|
||||
},
|
||||
}),
|
||||
Back: Object.freeze({
|
||||
In: function (amount) {
|
||||
var s = 1.70158;
|
||||
return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
|
||||
},
|
||||
Out: function (amount) {
|
||||
var s = 1.70158;
|
||||
return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
|
||||
},
|
||||
InOut: function (amount) {
|
||||
var s = 1.70158 * 1.525;
|
||||
if ((amount *= 2) < 1) {
|
||||
return 0.5 * (amount * amount * ((s + 1) * amount - s));
|
||||
}
|
||||
return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
|
||||
},
|
||||
}),
|
||||
Bounce: Object.freeze({
|
||||
In: function (amount) {
|
||||
return 1 - Easing.Bounce.Out(1 - amount);
|
||||
},
|
||||
Out: function (amount) {
|
||||
if (amount < 1 / 2.75) {
|
||||
return 7.5625 * amount * amount;
|
||||
}
|
||||
else if (amount < 2 / 2.75) {
|
||||
return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;
|
||||
}
|
||||
else if (amount < 2.5 / 2.75) {
|
||||
return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;
|
||||
}
|
||||
else {
|
||||
return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;
|
||||
}
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount < 0.5) {
|
||||
return Easing.Bounce.In(amount * 2) * 0.5;
|
||||
}
|
||||
return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
|
||||
},
|
||||
}),
|
||||
generatePow: function (power) {
|
||||
if (power === void 0) { power = 4; }
|
||||
power = power < Number.EPSILON ? Number.EPSILON : power;
|
||||
power = power > 10000 ? 10000 : power;
|
||||
return {
|
||||
In: function (amount) {
|
||||
return Math.pow(amount, power);
|
||||
},
|
||||
Out: function (amount) {
|
||||
return 1 - Math.pow((1 - amount), power);
|
||||
},
|
||||
InOut: function (amount) {
|
||||
if (amount < 0.5) {
|
||||
return Math.pow((amount * 2), power) / 2;
|
||||
}
|
||||
return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
var now = function () { return performance.now(); };
|
||||
|
||||
/**
|
||||
* Controlling groups of tweens
|
||||
*
|
||||
* Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
|
||||
* In these cases, you may want to create your own smaller groups of tween
|
||||
*/
|
||||
var Group = /** @class */ (function () {
|
||||
function Group() {
|
||||
this._tweens = {};
|
||||
this._tweensAddedDuringUpdate = {};
|
||||
}
|
||||
Group.prototype.getAll = function () {
|
||||
var _this = this;
|
||||
return Object.keys(this._tweens).map(function (tweenId) {
|
||||
return _this._tweens[tweenId];
|
||||
});
|
||||
};
|
||||
Group.prototype.removeAll = function () {
|
||||
this._tweens = {};
|
||||
};
|
||||
Group.prototype.add = function (tween) {
|
||||
this._tweens[tween.getId()] = tween;
|
||||
this._tweensAddedDuringUpdate[tween.getId()] = tween;
|
||||
};
|
||||
Group.prototype.remove = function (tween) {
|
||||
delete this._tweens[tween.getId()];
|
||||
delete this._tweensAddedDuringUpdate[tween.getId()];
|
||||
};
|
||||
Group.prototype.update = function (time, preserve) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (preserve === void 0) { preserve = false; }
|
||||
var tweenIds = Object.keys(this._tweens);
|
||||
if (tweenIds.length === 0) {
|
||||
return false;
|
||||
}
|
||||
// Tweens are updated in "batches". If you add a new tween during an
|
||||
// update, then the new tween will be updated in the next batch.
|
||||
// If you remove a tween during an update, it may or may not be updated.
|
||||
// However, if the removed tween was added during the current batch,
|
||||
// then it will not be updated.
|
||||
while (tweenIds.length > 0) {
|
||||
this._tweensAddedDuringUpdate = {};
|
||||
for (var i = 0; i < tweenIds.length; i++) {
|
||||
var tween = this._tweens[tweenIds[i]];
|
||||
var autoStart = !preserve;
|
||||
if (tween && tween.update(time, autoStart) === false && !preserve) {
|
||||
delete this._tweens[tweenIds[i]];
|
||||
}
|
||||
}
|
||||
tweenIds = Object.keys(this._tweensAddedDuringUpdate);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
return Group;
|
||||
}());
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var Interpolation = {
|
||||
Linear: function (v, k) {
|
||||
var m = v.length - 1;
|
||||
var f = m * k;
|
||||
var i = Math.floor(f);
|
||||
var fn = Interpolation.Utils.Linear;
|
||||
if (k < 0) {
|
||||
return fn(v[0], v[1], f);
|
||||
}
|
||||
if (k > 1) {
|
||||
return fn(v[m], v[m - 1], m - f);
|
||||
}
|
||||
return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);
|
||||
},
|
||||
Bezier: function (v, k) {
|
||||
var b = 0;
|
||||
var n = v.length - 1;
|
||||
var pw = Math.pow;
|
||||
var bn = Interpolation.Utils.Bernstein;
|
||||
for (var i = 0; i <= n; i++) {
|
||||
b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
|
||||
}
|
||||
return b;
|
||||
},
|
||||
CatmullRom: function (v, k) {
|
||||
var m = v.length - 1;
|
||||
var f = m * k;
|
||||
var i = Math.floor(f);
|
||||
var fn = Interpolation.Utils.CatmullRom;
|
||||
if (v[0] === v[m]) {
|
||||
if (k < 0) {
|
||||
i = Math.floor((f = m * (1 + k)));
|
||||
}
|
||||
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
|
||||
}
|
||||
else {
|
||||
if (k < 0) {
|
||||
return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);
|
||||
}
|
||||
if (k > 1) {
|
||||
return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
|
||||
}
|
||||
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);
|
||||
}
|
||||
},
|
||||
Utils: {
|
||||
Linear: function (p0, p1, t) {
|
||||
return (p1 - p0) * t + p0;
|
||||
},
|
||||
Bernstein: function (n, i) {
|
||||
var fc = Interpolation.Utils.Factorial;
|
||||
return fc(n) / fc(i) / fc(n - i);
|
||||
},
|
||||
Factorial: (function () {
|
||||
var a = [1];
|
||||
return function (n) {
|
||||
var s = 1;
|
||||
if (a[n]) {
|
||||
return a[n];
|
||||
}
|
||||
for (var i = n; i > 1; i--) {
|
||||
s *= i;
|
||||
}
|
||||
a[n] = s;
|
||||
return s;
|
||||
};
|
||||
})(),
|
||||
CatmullRom: function (p0, p1, p2, p3, t) {
|
||||
var v0 = (p2 - p0) * 0.5;
|
||||
var v1 = (p3 - p1) * 0.5;
|
||||
var t2 = t * t;
|
||||
var t3 = t * t2;
|
||||
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Utils
|
||||
*/
|
||||
var Sequence = /** @class */ (function () {
|
||||
function Sequence() {
|
||||
}
|
||||
Sequence.nextId = function () {
|
||||
return Sequence._nextId++;
|
||||
};
|
||||
Sequence._nextId = 0;
|
||||
return Sequence;
|
||||
}());
|
||||
|
||||
var mainGroup = new Group();
|
||||
|
||||
/**
|
||||
* Tween.js - Licensed under the MIT license
|
||||
* https://github.com/tweenjs/tween.js
|
||||
* ----------------------------------------------
|
||||
*
|
||||
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
|
||||
* Thank you all, you're awesome!
|
||||
*/
|
||||
var Tween = /** @class */ (function () {
|
||||
function Tween(_object, _group) {
|
||||
if (_group === void 0) { _group = mainGroup; }
|
||||
this._object = _object;
|
||||
this._group = _group;
|
||||
this._isPaused = false;
|
||||
this._pauseStart = 0;
|
||||
this._valuesStart = {};
|
||||
this._valuesEnd = {};
|
||||
this._valuesStartRepeat = {};
|
||||
this._duration = 1000;
|
||||
this._isDynamic = false;
|
||||
this._initialRepeat = 0;
|
||||
this._repeat = 0;
|
||||
this._yoyo = false;
|
||||
this._isPlaying = false;
|
||||
this._reversed = false;
|
||||
this._delayTime = 0;
|
||||
this._startTime = 0;
|
||||
this._easingFunction = Easing.Linear.None;
|
||||
this._interpolationFunction = Interpolation.Linear;
|
||||
// eslint-disable-next-line
|
||||
this._chainedTweens = [];
|
||||
this._onStartCallbackFired = false;
|
||||
this._onEveryStartCallbackFired = false;
|
||||
this._id = Sequence.nextId();
|
||||
this._isChainStopped = false;
|
||||
this._propertiesAreSetUp = false;
|
||||
this._goToEnd = false;
|
||||
}
|
||||
Tween.prototype.getId = function () {
|
||||
return this._id;
|
||||
};
|
||||
Tween.prototype.isPlaying = function () {
|
||||
return this._isPlaying;
|
||||
};
|
||||
Tween.prototype.isPaused = function () {
|
||||
return this._isPaused;
|
||||
};
|
||||
Tween.prototype.getDuration = function () {
|
||||
return this._duration;
|
||||
};
|
||||
Tween.prototype.to = function (target, duration) {
|
||||
if (duration === void 0) { duration = 1000; }
|
||||
if (this._isPlaying)
|
||||
throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
|
||||
this._valuesEnd = target;
|
||||
this._propertiesAreSetUp = false;
|
||||
this._duration = duration < 0 ? 0 : duration;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.duration = function (duration) {
|
||||
if (duration === void 0) { duration = 1000; }
|
||||
this._duration = duration < 0 ? 0 : duration;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.dynamic = function (dynamic) {
|
||||
if (dynamic === void 0) { dynamic = false; }
|
||||
this._isDynamic = dynamic;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.start = function (time, overrideStartingValues) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (overrideStartingValues === void 0) { overrideStartingValues = false; }
|
||||
if (this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.add(this);
|
||||
this._repeat = this._initialRepeat;
|
||||
if (this._reversed) {
|
||||
// If we were reversed (f.e. using the yoyo feature) then we need to
|
||||
// flip the tween direction back to forward.
|
||||
this._reversed = false;
|
||||
for (var property in this._valuesStartRepeat) {
|
||||
this._swapEndStartRepeatValues(property);
|
||||
this._valuesStart[property] = this._valuesStartRepeat[property];
|
||||
}
|
||||
}
|
||||
this._isPlaying = true;
|
||||
this._isPaused = false;
|
||||
this._onStartCallbackFired = false;
|
||||
this._onEveryStartCallbackFired = false;
|
||||
this._isChainStopped = false;
|
||||
this._startTime = time;
|
||||
this._startTime += this._delayTime;
|
||||
if (!this._propertiesAreSetUp || overrideStartingValues) {
|
||||
this._propertiesAreSetUp = true;
|
||||
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
||||
if (!this._isDynamic) {
|
||||
var tmp = {};
|
||||
for (var prop in this._valuesEnd)
|
||||
tmp[prop] = this._valuesEnd[prop];
|
||||
this._valuesEnd = tmp;
|
||||
}
|
||||
this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.startFromCurrentValues = function (time) {
|
||||
return this.start(time, true);
|
||||
};
|
||||
Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
|
||||
for (var property in _valuesEnd) {
|
||||
var startValue = _object[property];
|
||||
var startValueIsArray = Array.isArray(startValue);
|
||||
var propType = startValueIsArray ? 'array' : typeof startValue;
|
||||
var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]);
|
||||
// If `to()` specifies a property that doesn't exist in the source object,
|
||||
// we should not set that property in the object
|
||||
if (propType === 'undefined' || propType === 'function') {
|
||||
continue;
|
||||
}
|
||||
// Check if an Array was provided as property value
|
||||
if (isInterpolationList) {
|
||||
var endValues = _valuesEnd[property];
|
||||
if (endValues.length === 0) {
|
||||
continue;
|
||||
}
|
||||
// Handle an array of relative values.
|
||||
// Creates a local copy of the Array with the start value at the front
|
||||
var temp = [startValue];
|
||||
for (var i = 0, l = endValues.length; i < l; i += 1) {
|
||||
var value = this._handleRelativeValue(startValue, endValues[i]);
|
||||
if (isNaN(value)) {
|
||||
isInterpolationList = false;
|
||||
console.warn('Found invalid interpolation list. Skipping.');
|
||||
break;
|
||||
}
|
||||
temp.push(value);
|
||||
}
|
||||
if (isInterpolationList) {
|
||||
// if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
|
||||
_valuesEnd[property] = temp;
|
||||
// }
|
||||
}
|
||||
}
|
||||
// handle the deepness of the values
|
||||
if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
|
||||
_valuesStart[property] = startValueIsArray ? [] : {};
|
||||
var nestedObject = startValue;
|
||||
for (var prop in nestedObject) {
|
||||
_valuesStart[property][prop] = nestedObject[prop];
|
||||
}
|
||||
// TODO? repeat nested values? And yoyo? And array values?
|
||||
_valuesStartRepeat[property] = startValueIsArray ? [] : {};
|
||||
var endValues = _valuesEnd[property];
|
||||
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
||||
if (!this._isDynamic) {
|
||||
var tmp = {};
|
||||
for (var prop in endValues)
|
||||
tmp[prop] = endValues[prop];
|
||||
_valuesEnd[property] = endValues = tmp;
|
||||
}
|
||||
this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
|
||||
}
|
||||
else {
|
||||
// Save the starting value, but only once unless override is requested.
|
||||
if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
|
||||
_valuesStart[property] = startValue;
|
||||
}
|
||||
if (!startValueIsArray) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings
|
||||
}
|
||||
if (isInterpolationList) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_valuesStartRepeat[property] = _valuesEnd[property].slice().reverse();
|
||||
}
|
||||
else {
|
||||
_valuesStartRepeat[property] = _valuesStart[property] || 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Tween.prototype.stop = function () {
|
||||
if (!this._isChainStopped) {
|
||||
this._isChainStopped = true;
|
||||
this.stopChainedTweens();
|
||||
}
|
||||
if (!this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.remove(this);
|
||||
this._isPlaying = false;
|
||||
this._isPaused = false;
|
||||
if (this._onStopCallback) {
|
||||
this._onStopCallback(this._object);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.end = function () {
|
||||
this._goToEnd = true;
|
||||
this.update(Infinity);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.pause = function (time) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (this._isPaused || !this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
this._isPaused = true;
|
||||
this._pauseStart = time;
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.remove(this);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.resume = function (time) {
|
||||
if (time === void 0) { time = now(); }
|
||||
if (!this._isPaused || !this._isPlaying) {
|
||||
return this;
|
||||
}
|
||||
this._isPaused = false;
|
||||
this._startTime += time - this._pauseStart;
|
||||
this._pauseStart = 0;
|
||||
// eslint-disable-next-line
|
||||
this._group && this._group.add(this);
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.stopChainedTweens = function () {
|
||||
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
||||
this._chainedTweens[i].stop();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.group = function (group) {
|
||||
if (group === void 0) { group = mainGroup; }
|
||||
this._group = group;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.delay = function (amount) {
|
||||
if (amount === void 0) { amount = 0; }
|
||||
this._delayTime = amount;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.repeat = function (times) {
|
||||
if (times === void 0) { times = 0; }
|
||||
this._initialRepeat = times;
|
||||
this._repeat = times;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.repeatDelay = function (amount) {
|
||||
this._repeatDelayTime = amount;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.yoyo = function (yoyo) {
|
||||
if (yoyo === void 0) { yoyo = false; }
|
||||
this._yoyo = yoyo;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.easing = function (easingFunction) {
|
||||
if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
|
||||
this._easingFunction = easingFunction;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.interpolation = function (interpolationFunction) {
|
||||
if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
|
||||
this._interpolationFunction = interpolationFunction;
|
||||
return this;
|
||||
};
|
||||
// eslint-disable-next-line
|
||||
Tween.prototype.chain = function () {
|
||||
var tweens = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
tweens[_i] = arguments[_i];
|
||||
}
|
||||
this._chainedTweens = tweens;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onStart = function (callback) {
|
||||
this._onStartCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onEveryStart = function (callback) {
|
||||
this._onEveryStartCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onUpdate = function (callback) {
|
||||
this._onUpdateCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onRepeat = function (callback) {
|
||||
this._onRepeatCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onComplete = function (callback) {
|
||||
this._onCompleteCallback = callback;
|
||||
return this;
|
||||
};
|
||||
Tween.prototype.onStop = function (callback) {
|
||||
this._onStopCallback = callback;
|
||||
return this;
|
||||
};
|
||||
/**
|
||||
* @returns true if the tween is still playing after the update, false
|
||||
* otherwise (calling update on a paused tween still returns true because
|
||||
* it is still playing, just paused).
|
||||
*/
|
||||
Tween.prototype.update = function (time, autoStart) {
|
||||
var _this = this;
|
||||
var _a;
|
||||
if (time === void 0) { time = now(); }
|
||||
if (autoStart === void 0) { autoStart = true; }
|
||||
if (this._isPaused)
|
||||
return true;
|
||||
var property;
|
||||
var endTime = this._startTime + this._duration;
|
||||
if (!this._goToEnd && !this._isPlaying) {
|
||||
if (time > endTime)
|
||||
return false;
|
||||
if (autoStart)
|
||||
this.start(time, true);
|
||||
}
|
||||
this._goToEnd = false;
|
||||
if (time < this._startTime) {
|
||||
return true;
|
||||
}
|
||||
if (this._onStartCallbackFired === false) {
|
||||
if (this._onStartCallback) {
|
||||
this._onStartCallback(this._object);
|
||||
}
|
||||
this._onStartCallbackFired = true;
|
||||
}
|
||||
if (this._onEveryStartCallbackFired === false) {
|
||||
if (this._onEveryStartCallback) {
|
||||
this._onEveryStartCallback(this._object);
|
||||
}
|
||||
this._onEveryStartCallbackFired = true;
|
||||
}
|
||||
var elapsedTime = time - this._startTime;
|
||||
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
||||
var totalTime = this._duration + this._repeat * durationAndDelay;
|
||||
var calculateElapsedPortion = function () {
|
||||
if (_this._duration === 0)
|
||||
return 1;
|
||||
if (elapsedTime > totalTime) {
|
||||
return 1;
|
||||
}
|
||||
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
||||
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
||||
// TODO use %?
|
||||
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
||||
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
||||
if (portion === 0 && elapsedTime === _this._duration) {
|
||||
return 1;
|
||||
}
|
||||
return portion;
|
||||
};
|
||||
var elapsed = calculateElapsedPortion();
|
||||
var value = this._easingFunction(elapsed);
|
||||
// properties transformations
|
||||
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
||||
if (this._onUpdateCallback) {
|
||||
this._onUpdateCallback(this._object, elapsed);
|
||||
}
|
||||
if (this._duration === 0 || elapsedTime >= this._duration) {
|
||||
if (this._repeat > 0) {
|
||||
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
||||
if (isFinite(this._repeat)) {
|
||||
this._repeat -= completeCount;
|
||||
}
|
||||
// Reassign starting values, restart by making startTime = now
|
||||
for (property in this._valuesStartRepeat) {
|
||||
if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {
|
||||
this._valuesStartRepeat[property] =
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
|
||||
}
|
||||
if (this._yoyo) {
|
||||
this._swapEndStartRepeatValues(property);
|
||||
}
|
||||
this._valuesStart[property] = this._valuesStartRepeat[property];
|
||||
}
|
||||
if (this._yoyo) {
|
||||
this._reversed = !this._reversed;
|
||||
}
|
||||
this._startTime += durationAndDelay * completeCount;
|
||||
if (this._onRepeatCallback) {
|
||||
this._onRepeatCallback(this._object);
|
||||
}
|
||||
this._onEveryStartCallbackFired = false;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (this._onCompleteCallback) {
|
||||
this._onCompleteCallback(this._object);
|
||||
}
|
||||
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
||||
// Make the chained tweens start exactly at the time they should,
|
||||
// even if the `update()` method was called way past the duration of the tween
|
||||
this._chainedTweens[i].start(this._startTime + this._duration, false);
|
||||
}
|
||||
this._isPlaying = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {
|
||||
for (var property in _valuesEnd) {
|
||||
// Don't update properties that do not exist in the source object
|
||||
if (_valuesStart[property] === undefined) {
|
||||
continue;
|
||||
}
|
||||
var start = _valuesStart[property] || 0;
|
||||
var end = _valuesEnd[property];
|
||||
var startIsArray = Array.isArray(_object[property]);
|
||||
var endIsArray = Array.isArray(end);
|
||||
var isInterpolationList = !startIsArray && endIsArray;
|
||||
if (isInterpolationList) {
|
||||
_object[property] = this._interpolationFunction(end, value);
|
||||
}
|
||||
else if (typeof end === 'object' && end) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
this._updateProperties(_object[property], start, end, value);
|
||||
}
|
||||
else {
|
||||
// Parses relative end values with start as base (e.g.: +10, -3)
|
||||
end = this._handleRelativeValue(start, end);
|
||||
// Protect against non numeric properties.
|
||||
if (typeof end === 'number') {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore FIXME?
|
||||
_object[property] = start + (end - start) * value;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Tween.prototype._handleRelativeValue = function (start, end) {
|
||||
if (typeof end !== 'string') {
|
||||
return end;
|
||||
}
|
||||
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
|
||||
return start + parseFloat(end);
|
||||
}
|
||||
return parseFloat(end);
|
||||
};
|
||||
Tween.prototype._swapEndStartRepeatValues = function (property) {
|
||||
var tmp = this._valuesStartRepeat[property];
|
||||
var endValue = this._valuesEnd[property];
|
||||
if (typeof endValue === 'string') {
|
||||
this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);
|
||||
}
|
||||
else {
|
||||
this._valuesStartRepeat[property] = this._valuesEnd[property];
|
||||
}
|
||||
this._valuesEnd[property] = tmp;
|
||||
};
|
||||
return Tween;
|
||||
}());
|
||||
|
||||
var VERSION = '23.1.3';
|
||||
|
||||
/**
|
||||
* Tween.js - Licensed under the MIT license
|
||||
* https://github.com/tweenjs/tween.js
|
||||
* ----------------------------------------------
|
||||
*
|
||||
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
|
||||
* Thank you all, you're awesome!
|
||||
*/
|
||||
var nextId = Sequence.nextId;
|
||||
/**
|
||||
* Controlling groups of tweens
|
||||
*
|
||||
* Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
|
||||
* In these cases, you may want to create your own smaller groups of tweens.
|
||||
*/
|
||||
var TWEEN = mainGroup;
|
||||
// This is the best way to export things in a way that's compatible with both ES
|
||||
// Modules and CommonJS, without build hacks, and so as not to break the
|
||||
// existing API.
|
||||
// https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
|
||||
var getAll = TWEEN.getAll.bind(TWEEN);
|
||||
var removeAll = TWEEN.removeAll.bind(TWEEN);
|
||||
var add = TWEEN.add.bind(TWEEN);
|
||||
var remove = TWEEN.remove.bind(TWEEN);
|
||||
var update = TWEEN.update.bind(TWEEN);
|
||||
var exports$1 = {
|
||||
Easing: Easing,
|
||||
Group: Group,
|
||||
Interpolation: Interpolation,
|
||||
now: now,
|
||||
Sequence: Sequence,
|
||||
nextId: nextId,
|
||||
Tween: Tween,
|
||||
VERSION: VERSION,
|
||||
getAll: getAll,
|
||||
removeAll: removeAll,
|
||||
add: add,
|
||||
remove: remove,
|
||||
update: update,
|
||||
};
|
||||
|
||||
exports.Easing = Easing;
|
||||
exports.Group = Group;
|
||||
exports.Interpolation = Interpolation;
|
||||
exports.Sequence = Sequence;
|
||||
exports.Tween = Tween;
|
||||
exports.VERSION = VERSION;
|
||||
exports.add = add;
|
||||
exports.default = exports$1;
|
||||
exports.getAll = getAll;
|
||||
exports.nextId = nextId;
|
||||
exports.now = now;
|
||||
exports.remove = remove;
|
||||
exports.removeAll = removeAll;
|
||||
exports.update = update;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
64
web-app/node_modules/@tweenjs/tween.js/package.json
generated
vendored
Normal file
64
web-app/node_modules/@tweenjs/tween.js/package.json
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "@tweenjs/tween.js",
|
||||
"description": "Simple and fast tweening engine with optimised Robert Penner's equations.",
|
||||
"version": "23.1.3",
|
||||
"type": "module",
|
||||
"main": "dist/tween.cjs",
|
||||
"types": "dist/tween.d.ts",
|
||||
"module": "dist/tween.esm.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/tween.esm.js",
|
||||
"require": "./dist/tween.cjs",
|
||||
"types": "./dist/tween.d.ts"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"homepage": "https://github.com/tweenjs/tween.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tweenjs/tween.js.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tweenjs/tween.js/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"tween",
|
||||
"interpolation"
|
||||
],
|
||||
"dependencies": {},
|
||||
"scripts": {
|
||||
"dev": "(npm run tsc-watch -- --preserveWatchOutput & p1=$!; npm run rollup-build -- --watch & p2=$!; wait $p1 $p2)",
|
||||
"build": "rimraf dist .tmp && node scripts/write-version.js && npm run tsc && npm run rollup-build",
|
||||
"rollup-build": "rollup -c ./rollup.config.js",
|
||||
"tsc": "tsc",
|
||||
"tsc-watch": "tsc --watch",
|
||||
"examples": "npx serve .",
|
||||
"test": "npm run build && npm run test-lint && npm run test-unit",
|
||||
"test-unit": "nodeunit test/unit/nodeunitheadless.cjs",
|
||||
"test-lint": "npm run prettier -- --check",
|
||||
"lint": "npm run prettier -- --write",
|
||||
"prettier": "prettier .",
|
||||
"prepare": "npm run build",
|
||||
"version": "npm test && git add .",
|
||||
"release:patch": "npm version patch --message 'v%s' && npm publish && npm run _release:push-branch",
|
||||
"release:minor": "npm version minor --message 'v%s' && npm publish && npm run _release:push-branch",
|
||||
"release:major": "npm version major --message 'v%s' && npm publish && npm run _release:push-branch",
|
||||
"_release:push-branch": "git push --follow-tags --set-upstream origin `git rev-parse --abbrev-ref HEAD`"
|
||||
},
|
||||
"author": "tween.js contributors (https://github.com/tweenjs/tween.js/graphs/contributors)",
|
||||
"devDependencies": {
|
||||
"nodeunit": "^0.11.3",
|
||||
"prettier": "^3.0.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"rollup": "3.20.7",
|
||||
"rollup-plugin-dts": "5.3.0",
|
||||
"tslib": "^1.10.0",
|
||||
"typescript": "5.0.4"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user