Skip to content

Commit 01f9dc7

Browse files
committed
r6
1 parent ebc06ee commit 01f9dc7

18 files changed

+566
-75
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License
22

3-
Copyright (c) 2010 sole http://soledadpenades.com, Mr.doob http://mrdoob.com
3+
Copyright (c) 2010-2012 Tween.js authors.
44

55
Easing equations Copyright (c) 2001 Robert Penner http://robertpenner.com/easing/
66

README.md

+23-19
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
tween.js
22
========
33

4-
### Javascript Tweening Engine ###
4+
#### Javascript Tweening Engine ####
55

66
[![Flattr this](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/thing/45014/tween-js)
77

88
Super simple, fast and easy to use tweening engine which incorporates optimised Robert Penner's equations.
99

10-
We are still developing this so the API might change from commit to commit.
10+
[Contributors](http://github.com/sole/tween.js/contributors)
1111

12-
## Examples ##
12+
### Examples ###
1313

1414
[![Tween autostart](http://sole.github.com/tween.js/assets/examples/07_autostart.png)](http://sole.github.com/tween.js/examples/07_autostart.html)
1515
[![Video and time](http://sole.github.com/tween.js/assets/examples/06_video_and_time.png)](http://sole.github.com/tween.js/examples/06_video_and_time.html)
@@ -20,7 +20,7 @@ We are still developing this so the API might change from commit to commit.
2020
[![Bars](http://sole.github.com/tween.js/assets/examples/01_bars.png)](http://sole.github.com/tween.js/examples/01_bars.html)
2121
[![hello world](http://sole.github.com/tween.js/assets/examples/00_hello_world.png)](http://sole.github.com/tween.js/examples/00_hello_world.html)
2222

23-
## Projects using tween.js ##
23+
### Projects using tween.js ###
2424

2525
[![Minesweeper 3D](http://sole.github.com/tween.js/assets/projects/06_minesweeper3d.png)](http://egraether.com/mine3d/)
2626
[![ROME](http://sole.github.com/tween.js/assets/projects/05_rome.png)](http://ro.me)
@@ -30,7 +30,7 @@ We are still developing this so the API might change from commit to commit.
3030
[![The Wilderness Downtown](http://sole.github.com/tween.js/assets/projects/01_wilderness.png)](http://thewildernessdowntown.com/)
3131
[![Linechart](http://sole.github.com/tween.js/assets/projects/00_linechart.png)](http://dejavis.org/linechart)
3232

33-
## Usage ##
33+
### Usage ###
3434

3535
Download the [minified library](http://github.com/sole/tween.js/raw/master/build/Tween.js) and include it in your html.
3636

@@ -70,24 +70,31 @@ Have a look at that folder to discover more functionalities of the library!
7070

7171
Also, Jerome Etienne has written a [tutorial](http://learningthreejs.com/blog/2011/08/17/tweenjs-for-smooth-animation/) demonstrating how to use tween.js with three.js, and it's also great for understanding how tweens work!
7272

73-
## Frequently Asked Questions (FAQ) ##
73+
### FAQ ###
7474

75-
**Is there a way to control when is update() called? I'd like to use my own interval.**
76-
77-
Yes, simply don't call `TWEEN.start()`, and run `TWEEN.update()` in your own periodically executing function instead.
78-
7975
**How do you set a tween to start after a while?**
8076

81-
Use the `delay()` method: `var t = new Tween({...}).delay(1000);`
77+
Use the `delay()` method: `var t = new TWEEN.Tween({...}).delay(1000);`
8278

8379
**Is there a jQuery plug-in?**
8480

8581
No, we like to keep it simple and free of dependencies. Feel free to make one yourself, though! :-)
8682

8783

88-
## Change log ##
84+
### Change log ###
85+
86+
2012 04 10 - **r6** (4,707 KB, gzip: 1,630 KB)
87+
88+
* Returning instance also in `.chain()`. ([mrdoob](http://github.com/mrdoob))
89+
* Refactoring and code clean up. ([egraether](http://github.com/egraether))
90+
* Simplified easing formulas. ([infusion](http://github.com/infusion))
91+
* Added support to arrays in `.to()` using linear, catmull-rom or bezier `.interpolation()`. ([egraether](http://github.com/egraether))
92+
* Removed autostart/stop. ([mrdoob](http://github.com/mrdoob))
93+
* Renamed `EaseNone`, `EaseIn`, `EaseOut` ane `EaseInOut`, to `None`, `In`, `Out` and `InOut`. ([mrdoob](http://github.com/mrdoob))
94+
* Made `.to()` values dynamic. ([egraether](http://github.com/egraether) and [jeromeetienne](http://github.com/jeromeetienne))
8995

90-
2011 10 15 - **r5**
96+
97+
2011 10 15 - **r5** (4,733 KB, gzip: 1,379 KB)
9198

9299
* Add autostart/stop functionalities ([jocafa](http://github.com/jocafa) and [sole](http://github.com/sole))
93100
* Add 07_autostart example demonstrating the new functionalities ([sole](http://github.com/sole))
@@ -97,22 +104,19 @@ No, we like to keep it simple and free of dependencies. Feel free to make one yo
97104

98105
* Use ``Date.now()`` instead of ``new Date.getTime()`` as it's faster ([mrdoob](http://github.com/mrdoob))
99106

107+
100108
2011 09 30 - **r3**
101109

102110
* Added new ``time`` parameter to TWEEN.update, in order to allow synchronizing the tweens to an external timeline ([lechecacharro](http://github.com/lechecacharro))
103111
* Added example to demonstrate the new synchronizing feature. ([sole](http://github.com/sole))
104112

113+
105114
2011 06 18 - **r2**
106115

107116
* Added new utility methods getAll and removeAll for getting and removing all tweens ([Paul Lewis](http://github.com/paullewis))
108117

118+
109119
2011 05 18 - **r1**
110120

111121
* Started using revision numbers in the build file
112122
* Consider this kind of an stable revision :-)
113-
114-
## Contributors ##
115-
116-
People who have contributed directly or indirectly to this project :-D
117-
118-
[sole](http://soledadpenades.com), [mrdoob](http://mrdoob.com), [Robert Eisele](http://www.xarg.org/), [Robert Penner](http://www.robertpenner.com/), [Philippe Elsass](http://philippe.elsass.me), [Paul Lewis](http://www.aerotwist.com/), Lechecacharro

REVISION

-1
This file was deleted.

build/Tween.js

+12-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/00_hello_world.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h2>00 _ hello world</h2>
1515
hello world!
1616
</div>
1717

18-
<script src="../src/Tween.js"></script>
18+
<script src="../build/Tween.js"></script>
1919
<script src="js/RequestAnimationFrame.js"></script>
2020
<script>
2121
var position;

examples/01_bars.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h2>01 _ Bars</h2>
1313
</div>
1414
<div id="target"></div>
1515

16-
<script src="../src/Tween.js"></script>
16+
<script src="../build/Tween.js"></script>
1717
<script src="js/RequestAnimationFrame.js"></script>
1818
<script src="js/Stats.js"></script>
1919
<script>

examples/02_black_and_red.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ <h2>02 _ Black and red</h2>
2121
#target { position: absolute; top: 4em; right: 3em; }
2222
</style>
2323

24-
<script src="../src/Tween.js"></script>
24+
<script src="../build/Tween.js"></script>
2525
<script src="js/RequestAnimationFrame.js"></script>
2626
<script src="js/Stats.js"></script>
2727
<script>

examples/03_graphs.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h2>03 _ graphs</h2>
2525

2626
<div id="target"></div>
2727

28-
<script src="../src/Tween.js"></script>
28+
<script src="../build/Tween.js"></script>
2929
<script src="js/RequestAnimationFrame.js"></script>
3030
<script>
3131

examples/04_simplest.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h2>04 _ simplest possible example</h2>
1515
<div id="target" style="position: absolute; left: 50px; top: 300px; font-size: 100px; letter-spacing: -7px; ">
1616
</div>
1717

18-
<script src="../src/Tween.js"></script>
18+
<script src="../build/Tween.js"></script>
1919
<script src="js/RequestAnimationFrame.js"></script>
2020
<script>
2121

examples/05_video_and_time.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h2>05 _ video and time</h2>
1616
<video id="video" src="video/sintel.webm" width="320" height="138" autoplay></video>
1717
</div>
1818

19-
<script src="../src/Tween.js"></script>
19+
<script src="../build/Tween.js"></script>
2020
<script src="js/RequestAnimationFrame.js"></script>
2121
<script>
2222

examples/06_array_interpolation.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h2>06 _ array interpolation</h2>
2626

2727
<div id="target"></div>
2828

29-
<script src="../src/Tween.js"></script>
29+
<script src="../build/Tween.js"></script>
3030
<script src="js/RequestAnimationFrame.js"></script>
3131
<script>
3232

examples/07_dynamic_to.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h2>06 _ dynamic to</h2>
2626

2727
<div id="target"></div>
2828

29-
<script src="../src/Tween.js"></script>
29+
<script src="../build/Tween.js"></script>
3030
<script src="js/RequestAnimationFrame.js"></script>
3131
<script>
3232

src/Tween.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ var TWEEN = TWEEN || ( function () {
1616

1717
return {
1818

19+
REVISION: '6',
20+
1921
getAll: function () {
2022

2123
return _tweens;
@@ -75,17 +77,17 @@ var TWEEN = TWEEN || ( function () {
7577

7678
TWEEN.Tween = function ( object ) {
7779

78-
var _object = object,
79-
_valuesStart = {},
80-
_valuesEnd = {},
81-
_duration = 1000,
82-
_delayTime = 0,
83-
_startTime = null,
84-
_easingFunction = TWEEN.Easing.Linear.None,
85-
_interpolationFunction = TWEEN.Interpolation.Linear,
86-
_chainedTween = null,
87-
_onUpdateCallback = null,
88-
_onCompleteCallback = null;
80+
var _object = object;
81+
var _valuesStart = {};
82+
var _valuesEnd = {};
83+
var _duration = 1000;
84+
var _delayTime = 0;
85+
var _startTime = null;
86+
var _easingFunction = TWEEN.Easing.Linear.None;
87+
var _interpolationFunction = TWEEN.Interpolation.Linear;
88+
var _chainedTween = null;
89+
var _onUpdateCallback = null;
90+
var _onCompleteCallback = null;
8991

9092
this.to = function ( properties, duration ) {
9193

@@ -190,23 +192,21 @@ TWEEN.Tween = function ( object ) {
190192

191193
this.update = function ( time ) {
192194

193-
var property, elapsed, value, start, end;
194-
195195
if ( time < _startTime ) {
196196

197197
return true;
198198

199199
}
200200

201-
elapsed = ( time - _startTime ) / _duration;
201+
var elapsed = ( time - _startTime ) / _duration;
202202
elapsed = elapsed > 1 ? 1 : elapsed;
203203

204-
value = _easingFunction( elapsed );
204+
var value = _easingFunction( elapsed );
205205

206-
for ( property in _valuesStart ) {
206+
for ( var property in _valuesStart ) {
207207

208-
start = _valuesStart[ property ];
209-
end = _valuesEnd[ property ];
208+
var start = _valuesStart[ property ];
209+
var end = _valuesEnd[ property ];
210210

211211
if ( end instanceof Array ) {
212212

utils/builder.py

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
import sys
21
import os
32

4-
output = '../build/Tween.js';
3+
source = '../src/Tween.js'
4+
build = '../build/Tween.js'
5+
header = '// Tween.js - http://github.com/sole/tween.js\n'
56

6-
os.system("java -jar compiler.jar --js ../src/Tween.js --js_output_file %s" % (output))
7+
os.system( 'java -jar compiler/compiler.jar --language_in=ECMASCRIPT5 --js ' + source + ' --js_output_file ' + build )
78

8-
# HEADER
9+
file = open( build, 'r' )
10+
contents = file.read();
11+
file.close()
912

10-
with open(os.path.join('..', 'REVISION'), 'r') as handle:
11-
revision = handle.read().rstrip()
12-
13-
string = "// tween.js r%s - http://github.com/sole/tween.js\n" % (revision)
14-
15-
src_file = open(output,'r')
16-
string += src_file.read()
17-
18-
dep_file = open(output,'w')
19-
dep_file.write(string)
20-
dep_file.close()
13+
file = open( build, 'w' )
14+
file.write( header + contents )
15+
file.close()

utils/compiler.jar

-3.76 MB
Binary file not shown.

0 commit comments

Comments
 (0)