@tweenjs/tween.js
Advanced tools
Comparing version 17.4.0 to 18.0.0
{ | ||
"name": "@tweenjs/tween.js", | ||
"description": "Super simple, fast and easy to use tweening engine which incorporates optimised Robert Penner's equations.", | ||
"version": "17.4.0", | ||
"main": "src/Tween.js", | ||
"version": "18.0.0", | ||
"main": "dist/tween.cjs.js", | ||
"module": "dist/tween.esm.js", | ||
"homepage": "https://github.com/tweenjs/tween.js", | ||
@@ -21,3 +22,4 @@ "repository": { | ||
"scripts": { | ||
"test": "npm run test-unit && npm run test-correctness && npm run test-style", | ||
"build": "rollup -c ./rollup.config.js", | ||
"test": "npm run build && npm run test-unit && npm run test-correctness && npm run test-style", | ||
"test-unit": "nodeunit test/unit/nodeunitheadless.js", | ||
@@ -33,4 +35,4 @@ "test-correctness": "jshint --config test/jshintrc src/Tween.js", | ||
"nodeunit": "^0.9.5", | ||
"semantic-release": "^15.13.12" | ||
"rollup": "^0.57.1" | ||
} | ||
} |
@@ -11,4 +11,6 @@ # tween.js | ||
**Update Note** In v18.0.0 the script you should include has moved from `src/Tween.js` to `dist/tween.umd.js`. | ||
```javascript | ||
var box = document.createElement('div'); | ||
const box = document.createElement('div'); | ||
box.style.setProperty('background-color', '#008800'); | ||
@@ -26,9 +28,9 @@ box.style.setProperty('width', '100px'); | ||
var coords = { x: 0, y: 0 }; // Start at (0, 0) | ||
var tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'. | ||
const coords = { x: 0, y: 0 }; // Start at (0, 0) | ||
const tween = new TWEEN.Tween(coords) // Create a new tween that modifies 'coords'. | ||
.to({ x: 300, y: 200 }, 1000) // Move to (300, 200) in 1 second. | ||
.easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth. | ||
.onUpdate(function() { // Called after tween.js updates 'coords'. | ||
.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)'); | ||
box.style.setProperty('transform', `translate(${coords.x}px, ${coords.y}px)`); | ||
}) | ||
@@ -42,15 +44,16 @@ .start(); // Start the tween immediately. | ||
Download the [library](https://raw.githubusercontent.com/tweenjs/tween.js/master/src/Tween.js) and include it in your code: | ||
Download one of the builds of the library and include it in your code. For example: | ||
```html | ||
<script src="js/Tween.js"></script> | ||
<script src="js/tween.umd.js"></script> | ||
``` | ||
You can also reference a CDN-hosted version in your code, thanks to cdnjs. For example: | ||
There are currently four different builds of the library: | ||
```html | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tween.js/16.3.5/Tween.min.js"></script> | ||
``` | ||
- [UMD : tween.umd.js](https://raw.githubusercontent.com/tweenjs/tween.js/master/dist/tween.umd.js) | ||
- [AMD : tween.amd.js](https://raw.githubusercontent.com/tweenjs/tween.js/master/dist/tween.amd.js) | ||
- [CommonJS : tween.cjs.js](https://raw.githubusercontent.com/tweenjs/tween.js/master/dist/tween.cjs.js) | ||
- [ES6 Module : tween.es.js](https://raw.githubusercontent.com/tweenjs/tween.js/master/dist/tween.es.js) | ||
See [tween.js](https://cdnjs.com/libraries/tween.js/) for more versions. | ||
This library is available on [cdnjs](https://cdnjs.com/libraries/tween.js/). | ||
@@ -68,3 +71,3 @@ ### More advanced users might want to... | ||
```javascript | ||
var TWEEN = require('@tweenjs/tween.js'); | ||
const TWEEN = require('@tweenjs/tween.js'); | ||
``` | ||
@@ -75,3 +78,3 @@ | ||
```javascript | ||
var t = new TWEEN.Tween( /* etc */ ); | ||
const t = new TWEEN.Tween( /* etc */ ); | ||
t.start(); | ||
@@ -82,20 +85,2 @@ ``` | ||
#### Use `bower` | ||
```bash | ||
bower install @tweenjs/tweenjs --save | ||
``` | ||
or install an specific tag. They are git tags, and you can run `git tag` in the command line for a list if you have cloned the repository locally, or you can also check out the list in the [tween.js tags page](https://github.com/tweenjs/tween.js/tags). For example, to install `v16.3.0`: | ||
```bash | ||
bower install @tweenjs/tweenjs#v16.3.0 | ||
``` | ||
Then reference the library source: | ||
```html | ||
<script src="bower_components/@tweenjs/tweenjs/src/Tween.js"></script> | ||
``` | ||
## Features | ||
@@ -102,0 +87,0 @@ |
@@ -912,24 +912,2 @@ /** | ||
// UMD (Universal Module Definition) | ||
(function (root) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD | ||
define([], function () { | ||
return TWEEN; | ||
}); | ||
} else if (typeof module !== 'undefined' && typeof exports === 'object') { | ||
// Node.js | ||
module.exports = TWEEN; | ||
} else if (root !== undefined) { | ||
// Global variable | ||
root.TWEEN = TWEEN; | ||
} | ||
})(this); | ||
export default TWEEN; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41094
8
599
281