es6-tween
Advanced tools
Comparing version 5.4.3 to 5.5.0
{ | ||
"name": "es6-tween", | ||
"version": "5.4.3", | ||
"version": "5.5.0", | ||
"description": "ES6 implementation of amazing tween.js", | ||
@@ -5,0 +5,0 @@ "browser": "bundled/Tween.min.js", |
104
README.md
@@ -25,8 +25,7 @@ # es6-tween | ||
* [See docs at GitBook](https://tweenjs.gitbook.io/es6-tween/) | ||
* [Homepage](https://tweenjs.github.io/es6-tween/) (not completed) | ||
* [API documentation](./API.md) | ||
* [Wiki page](https://github.com/tweenjs/es6-tween/wiki) | ||
- [See docs at GitBook](https://tweenjs.gitbook.io/es6-tween/) | ||
- [Homepage](https://tweenjs.github.io/es6-tween/) (not completed) | ||
- [API documentation](./API.md) | ||
- [Wiki page](https://github.com/tweenjs/es6-tween/wiki) | ||
```javascript | ||
@@ -37,8 +36,7 @@ TWEEN.autoPlay(true); // simplify the your code | ||
let tween = new TWEEN.Tween(coords) | ||
.to({ x: 100, y: 100 }, 1000) | ||
.on('update', ({x, y}) => { | ||
console.log(`The values is x: ${x} and y: ${y}`); | ||
}) | ||
.start(); | ||
.to({ x: 100, y: 100 }, 1000) | ||
.on("update", ({ x, y }) => { | ||
console.log(`The values is x: ${x} and y: ${y}`); | ||
}) | ||
.start(); | ||
``` | ||
@@ -50,8 +48,7 @@ | ||
## Demos | ||
* Demo #1 [Morphing SVG Shape + Cross-browser SVG Transform](https://codepen.io/dalisoft/pen/mMJmxX) | ||
* Demo #2 [Morphing SVG Shape](https://codepen.io/dalisoft/pen/BdLydv) | ||
* Collection on the [Codepen](https://codepen.io/collection/DapBmv/) | ||
- Demo #1 [Morphing SVG Shape + Cross-browser SVG Transform](https://codepen.io/dalisoft/pen/mMJmxX) | ||
- Demo #2 [Morphing SVG Shape](https://codepen.io/dalisoft/pen/BdLydv) | ||
- Collection on the [Codepen](https://codepen.io/collection/DapBmv/) | ||
@@ -68,6 +65,6 @@ ## Installation | ||
* See [cdnjs-hosted version](https://cdnjs.com/libraries/es6-tween) for get which result you want | ||
* NOTE: `@latest` suffix sometimes saves life by loading latest, because sometimes CDN services will not load the latest | ||
- See [cdnjs-hosted version](https://cdnjs.com/libraries/es6-tween) for get which result you want | ||
- NOTE: `@latest` suffix sometimes saves life by loading latest, because sometimes CDN services will not load the latest | ||
* Now you can load from CDN | ||
- Now you can load from CDN | ||
@@ -78,7 +75,5 @@ ```html | ||
<!-- unpkg --> | ||
<script src="https://unpkg.com/es6-tween"></script> | ||
<!-- npmcdn --> | ||
@@ -88,3 +83,2 @@ <script src="https://npmcdn.com/es6-tween"></script> | ||
### More advanced users might want to... | ||
@@ -95,3 +89,3 @@ | ||
```javascript | ||
import { Easing, Tween, autoPlay } from 'es6-tween' | ||
import { Easing, Tween, autoPlay } from "es6-tween"; | ||
``` | ||
@@ -104,8 +98,8 @@ | ||
<script type="x-module"> | ||
// ES6 | ||
import { Easing, Tween, autoPlay } from 'es6-tween' | ||
// ES6 | ||
import { Easing, Tween, autoPlay } from 'es6-tween' | ||
// CommonJS | ||
const { Tween, Easing, autoPlay } = require('es6-tween') | ||
// CommonJS | ||
const { Tween, Easing, autoPlay } = require('es6-tween') | ||
</script> | ||
@@ -125,3 +119,3 @@ ``` | ||
```javascript | ||
const { Tween, Easing, autoPlay } = require('es6-tween'); | ||
const { Tween, Easing, autoPlay } = require("es6-tween"); | ||
``` | ||
@@ -132,3 +126,3 @@ | ||
```javascript | ||
const t = new Tween( /* etc */ ); | ||
const t = new Tween(/* etc */); | ||
t.start(); | ||
@@ -155,8 +149,8 @@ ``` | ||
* Tweens everything you give them, string, number, number of arrays, number of object, all-to, interpolators and much more. Endless possibilites | ||
* Can use CSS units (e.g. appending `px`) | ||
* Can interpolate colours | ||
* Easing functions are reusable outside of Tween | ||
* Can also use custom easing functions | ||
* Much of easings | ||
- Tweens everything you give them, string, number, number of arrays, number of object, all-to, interpolators and much more. Endless possibilites | ||
- Can use CSS units (e.g. appending `px`) | ||
- Can interpolate colours | ||
- Easing functions are reusable outside of Tween | ||
- Can also use custom easing functions | ||
- Much of easings | ||
@@ -180,23 +174,37 @@ ## Compatiblity Testing | ||
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. If you send a PR to add something new and it doesn't have tests, or the tests don't pass, the PR won't be accepted. See [contributing](CONTRIBUTING.md) for more information. | ||
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. If you send a PR to add something new and it doesn't have tests, or the tests don't pass, the PR won't be accepted. See [contributing](CONTRIBUTING.md) for more information. | ||
## People | ||
[All contributors](https://github.com/tweenjs/es6-tween/contributors). | ||
- [All contributors](https://github.com/tweenjs/es6-tween/contributors). | ||
- [es6-tween contributors](https://github.com/tweenjs/es6-tween/graphs/contributors)/ | ||
## Thanks to: | ||
* [es6-tween contributors](https://github.com/tweenjs/es6-tween/graphs/contributors) | ||
* Rollup, Buble, Travis CI, BrowserStack, jsDoc, docdash theme, TypeScript and others (make issue, if i'm missed you) with their teams, devs and supporters | ||
## Thanks to | ||
these tools developers and to their community and without these tools maybe this library wouldn't be possible | ||
- [GitHub](https://github.com/) | ||
- [Travis CI](http://travis-ci.org) | ||
- [BrowserStack](https://www.browserstack.com/) | ||
- [Node.js](https://nodejs.org/en/) | ||
- [ESLint](http://eslint.org) | ||
- [jsDoc](http://usejsdoc.org) ([docdash theme](https://github.com/clenemt/docdash)) | ||
- [Rollup](https://rollupjs.org/guide/en) | ||
- [Babel](https://babeljs.io) | ||
- [Ava](https://github.com/avajs/ava) | ||
- [Puppeteer](https://pptr.dev) | ||
- [UglifyJS v3](https://github.com/mishoo/UglifyJS2) | ||
- [Husky](https://github.com/typicode/husky) | ||
## Projects using es6-tween | ||
* [ft](https://github.com/2players/ft) | ||
* [react-heartwood-components](https://www.npmjs.com/package/@sprucelabs/react-heartwood-components) | ||
* [el-controls](https://github.com/eljs/el-controls) | ||
* [lightweight-pixijs-engine](https://github.com/dgzornoza/lightweight-pixijs-engine#readme) | ||
* [vue-sliderx](https://www.npmjs.com/package/vue-sliderx) | ||
* [vue-mapbox-feature](https://cityseer.github.io/vue-mapbox-feature) | ||
* [vuxtras](https://github.com/homerjam/vuxtras#readme) | ||
* [Slye](https://github.com/Slye3D/slye#readme) | ||
* [react-3d-globe](https://chrisrzhou.github.io/react-3d-globe/) | ||
- [ft](https://github.com/2players/ft) | ||
- [react-heartwood-components](https://www.npmjs.com/package/@sprucelabs/react-heartwood-components) | ||
- [el-controls](https://github.com/eljs/el-controls) | ||
- [lightweight-pixijs-engine](https://github.com/dgzornoza/lightweight-pixijs-engine#readme) | ||
- [vue-sliderx](https://www.npmjs.com/package/vue-sliderx) | ||
- [vue-mapbox-feature](https://cityseer.github.io/vue-mapbox-feature) | ||
- [vuxtras](https://github.com/homerjam/vuxtras#readme) | ||
- [Slye](https://github.com/Slye3D/slye#readme) | ||
- [react-3d-globe](https://chrisrzhou.github.io/react-3d-globe/) | ||
@@ -203,0 +211,0 @@ It's great to see this library to be used in production and/or library, thank you! |
@@ -58,2 +58,3 @@ /* global process */ | ||
let _tick | ||
let handleLag = true | ||
@@ -117,2 +118,13 @@ const onRequestTick = (fn) => { | ||
/** | ||
* Handle lag, useful if you have rendering Canvas or DOM objects or using es6-tween plugins | ||
* @param {number} [state=true] handle lag state | ||
* @memberof TWEEN | ||
* @example | ||
* TWEEN.ToggleLagSmoothing(false) | ||
*/ | ||
const ToggleLagSmoothing = (_state = true) => { | ||
handleLag = _state | ||
} | ||
/** | ||
* @returns {Array<Tween>} List of tweens in Array | ||
@@ -242,2 +254,10 @@ * @memberof TWEEN | ||
/** | ||
* Returns state of lag smoothing handling | ||
* @return {Boolean} Status of lag smoothing state | ||
* @memberof TWEEN | ||
* @example TWEEN.isRunning() | ||
*/ | ||
const isLagSmoothing = () => handleLag | ||
/** | ||
* The plugins store object | ||
@@ -269,3 +289,5 @@ * @namespace TWEEN.Plugins | ||
isRunning, | ||
FrameThrottle | ||
isLagSmoothing, | ||
FrameThrottle, | ||
ToggleLagSmoothing | ||
} |
@@ -1,2 +0,2 @@ | ||
import { add, now, remove, isRunning } from './core' | ||
import { add, now, remove, isRunning, isLagSmoothing } from './core' | ||
import PlaybackPosition from './PlaybackPosition' | ||
@@ -263,3 +263,3 @@ import Tween from './Tween' | ||
this._prevTime = time | ||
if (delta > TOO_LONG_FRAME_MS && isRunning()) { | ||
if (delta > TOO_LONG_FRAME_MS && isRunning() && isLagSmoothing()) { | ||
time -= delta - FRAME_MS | ||
@@ -266,0 +266,0 @@ } |
@@ -6,3 +6,4 @@ import { | ||
remove, | ||
isRunning | ||
isRunning, | ||
isLagSmoothing | ||
} from './core' | ||
@@ -738,3 +739,3 @@ import Easing from './Easing' | ||
this._prevTime = time | ||
if (delta > TOO_LONG_FRAME_MS && isRunning()) { | ||
if (delta > TOO_LONG_FRAME_MS && isRunning() && isLagSmoothing()) { | ||
time -= delta - FRAME_MS | ||
@@ -741,0 +742,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
369843
5009
213