Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
* v3.6.0
Browse files Browse the repository at this point in the history
* introduce the fast lite version
  • Loading branch information
dalisoft committed Sep 7, 2017
1 parent 2042f5e commit 1c7a138
Show file tree
Hide file tree
Showing 15 changed files with 668 additions and 101 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

ES6 implementation of <a href="https://github.com/tweenjs/tween.js">tween.js</a>

# News (`Lite` version is released)!

You can use the `Lite` version of ES6 which lighter (~8Kb minified), faster (~10% faster executioin), simpler (like the original one), memory effecient and better (can tween second-level Objects/Array). Optimized for runtime performance, no-lag anymore.
When you want building mobile apps that loading files from server, use `Lite` for better performance.
Differences when using `Lite`:
* 2-times lighter size
* No `Timeline` instance
* No `String` tween support
* No `Deep tween` support (does 2-level)
* Uses original `Interpolation` instances for `Bezier` interpolation
* Faster performance and execution speed
* Memory effecient
* No more shims required
* No `Plugins` support
* No `DOM Get/Set`, `Renderer` instance/plugin/add-on support
* No full-Event system, just 3 event support (`onStart`, `onUpdate`, `onComplete`)
* No `seek`, `reverse` support
* No event fire when `stop`, `pause`, `etc`
* No `*`, `/`, `%` relatives support

[![size](http://img.badgesize.io/https://unpkg.com/es6-tween?cache=false)](http://unpkg.com/es6-tween)
[![gzipsize](http://img.badgesize.io/https://unpkg.com/es6-tween?compression=gzip&cache=false)](http://unpkg.com/es6-tween)
[![CDNJS](https://img.shields.io/cdnjs/v/es6-tween.svg)](https://cdnjs.com/libraries/es6-tween)
Expand Down
13 changes: 7 additions & 6 deletions examples/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

.line {
width: 200px;
height: 1px;
height: 2px;
position: absolute;
}
</style>
Expand All @@ -27,6 +27,7 @@

<script src="../dist/Tween.js"></script>
<script src="../../es6-tween-plugins/renderer/index.js"></script>
<script !src="../../es6-tween-plugins/transform/transform.js"></script>
<script>
TWEEN.autoPlay(true);

Expand All @@ -35,7 +36,7 @@
}

function update (v) {
v.el.style.transform = 'translate3d(' + v.x + 'px, 0px, 0px)';
v.el.style.transform = 'translate3d(' + ((v.x * 10) | 0) / 10 + 'px, 0px, 0px)';
}

var nodes = [],
Expand All @@ -61,17 +62,17 @@
tl = Math.floor(random(-200, 200));
div.setAttribute("class", "line");
div.style.top = [(Math.random() * wIh), "px"].join("");
//div.style.left = l + 'px';
div.style.transform = "translate3d(" + l + "px, 0px, 0px)";
div.style.left = l + 'px';
//div.style.transform = "translate3d(" + l + "px, 0px, 0px)";
div.style.backgroundColor = bgC;
var a = new TWEEN.Tween(div, { x : l }).to({ x: tl }, 1000).easing(TWEEN.Easing.Quadratic.InOut).repeat(Infinity).yoyo(true).start();
var a = new TWEEN.Tween(div, { left : l }).to({ left: tl }, 1000).easing(TWEEN.Easing.Quadratic.InOut).repeat(Infinity).yoyo(true).start();

frag.appendChild(div);

}
c.appendChild(frag);
}
createTest(500);
createTest(200);
</script>

</body>
Expand Down
42 changes: 42 additions & 0 deletions lite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import buble from 'rollup-plugin-buble'
import uglify from 'rollup-plugin-uglify'
import { minify } from 'uglify-es'

const { min } = process.env
const isMinify = min === 'true'
const minSuffix = isMinify ? '.min' : ''

const plugins = [
// ES6->ES5 syntax/code transpiler
buble({
// Spread to Object merge/assign
objectAssign: `Object.assign`,
// Features
transforms: {
// For of feature
dangerousForOf: true
}
})
]

if ( isMinify ) {
plugins.push(
// Minify
uglify({
sourceMap: {
filename: `src/Tween.js`,
url: `lite/Tween${minSuffix}.js.map`
}
}, minify)
);
}

export default {
entry: 'src/Tween.Lite.js',
format: 'umd',
sourceMap: true,
context: 'this',
dest: `lite/Tween${minSuffix}.js`,
moduleName: 'TWEEN',
plugins: plugins
}
14 changes: 14 additions & 0 deletions logo/box.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions logo/es6-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "es6-tween",
"version": "3.5.9",
"version": "3.6.0",
"description": "ES6 implementation of amazing tween.js",
"browser": "dist/Tween.min.js",
"cdn": "dist/Tween.min.js",
Expand All @@ -13,12 +13,17 @@
"source": "rollup -c --environment min:false",
"minify": "rollup -c --environment min:true",
"build": "npm run source && npm run minify",
"source-lite": "rollup -c lite.js --environment min:false",
"minify-lite": "rollup -c lite.js --environment min:true",
"build-lite": "npm run source-lite && npm run minify-lite",
"prepare": "npm run build && npm run build-lite",
"dev": "rollup -c -w",
"dev-lite": "rollup -c lite.js -w",
"lint": "eslint src",
"fix": "eslint --fix src",
"test-unit": "nodeunit test/unit/nodeunitheadless.js",
"test": "npm run lint && ava --verbose",
"prepublishOnly": "npm run lint && npm run build && ava --verbose"
"prepublishOnly": "npm run lint && npm run prepare && ava --verbose"
},
"repository": {
"type": "git",
Expand Down
42 changes: 42 additions & 0 deletions rollup.config.lite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import buble from 'rollup-plugin-buble'
import uglify from 'rollup-plugin-uglify'
import { minify } from 'uglify-es'

const { min } = process.env
const isMinify = min === 'true'
const minSuffix = isMinify ? '.min' : ''

const plugins = [
// ES6->ES5 syntax/code transpiler
buble({
// Spread to Object merge/assign
objectAssign: `Object.assign`,
// Features
transforms: {
// For of feature
dangerousForOf: true
}
})
]

if ( isMinify ) {
plugins.push(
// Minify
uglify({
sourceMap: {
filename: `src/Tween.Lite.js`,
url: `dist/Tween.Lite${minSuffix}.js.map`
}
}, minify)
);
}

export default {
entry: 'src/Tween.Lite.js',
format: 'umd',
sourceMap: true,
context: 'this',
dest: `dist/Tween.Lite${minSuffix}.js`,
moduleName: 'TWEEN',
plugins: plugins
}
4 changes: 4 additions & 0 deletions src/Tween.Lite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { has, get, getAll, removeAll, remove, add, now, update, autoPlay, Plugins, isRunning } from './dist/core'
import Easing from './dist/Easing'
import Tween from './dist/Tween.Lite'
export { Plugins, has, get, getAll, removeAll, remove, add, now, update, autoPlay, isRunning, Tween, Easing }
6 changes: 4 additions & 2 deletions src/dist/NodeCache.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { assign } from '../shim'

let Store = {}
export default function (node, tween) {
if (!node || !node.nodeType) return tween
if (!node || !node.nodeType || !tween) return tween
var ID = node.queueID || 'queue_' + Math.round(Math.random() * 1000 + Date.now())
if (!node.queueID) {
node.queueID = ID
}
if (Store[ID]) {
if (tween) {
Store[ID] = Object.assign(Store[ID], tween)
Store[ID] = assign(Store[ID], tween)
}
return Store[ID]
}
Expand Down
Loading

0 comments on commit 1c7a138

Please sign in to comment.