Skip to content

Commit

Permalink
Removed the prematurely included duration option. Technically, this…
Browse files Browse the repository at this point in the history
… API change can not land earlier than in 1.3. Please use [gh-90-duration branch](/pisi/Reel/tree/gh-90-duration] instead if you are interested in setting up animation duration. The `duration` option there is fully working and will be released in version 1.3.
  • Loading branch information
pisi committed Feb 20, 2013
1 parent 63a2c69 commit 51f0e74
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 146 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.markdown
Expand Up @@ -9,7 +9,6 @@ Development
* Goodbye disableTextSelect dependency. You served well, but one less to worry about without you!
* Vertical page scrolling on touch devices fixed (GH-146).
* Release package now contains image assets otherwise served by CND (GH-144).
* New `duration` option for the animation (GH-90).
* Case in-sensitivity for image extension in `src` attribute of the `<img>`.
* Exciting new multi-row panoramas via combination of `multirow` and `stitched` options (GH-129).
* The `throwable` option can now accept maximum velocity instead of simple boolean (GH-172).
Expand Down
3 changes: 1 addition & 2 deletions example/object-movie-clockwise-sequence/README.markdown
Expand Up @@ -5,15 +5,14 @@ This example demonstrates a advanced sequence, where only a handful of
available rendered frames is used (every fifth out of 180 total; e.g.
00001.png, 00006.png, ...) with frames rendered in a clockwise fashion.
It animates clockwise one revolution per 5 seconds with an additional
velocity kick at the start and total duration of 6 seconds.
velocity kick at the start.


Options Employed In This Example
--------------------------------

- [brake](http://jquery.vostrel.cz/reel#brake)
- [cw](http://jquery.vostrel.cz/reel#cw)
- [duration](http://jquery.vostrel.cz/reel#duration)
- [frame](http://jquery.vostrel.cz/reel#frame)
- [images](http://jquery.vostrel.cz/reel#images)
- [speed](http://jquery.vostrel.cz/reel#speed)
Expand Down
1 change: 0 additions & 1 deletion example/object-movie-clockwise-sequence/index.html
Expand Up @@ -23,7 +23,6 @@ <h1>Clockwise Sequence</h1>
frame: 32,
speed: -0.2,
velocity: 3,
duration: 6,
brake: 0.2,
images: 'drone/#####.png|1..179|5',
annotations: {
Expand Down
66 changes: 33 additions & 33 deletions jquery.reel-min.js

Large diffs are not rendered by default.

18 changes: 4 additions & 14 deletions jquery.reel.js
Expand Up @@ -471,11 +471,6 @@ jQuery.reel || (function($, window, document, undefined){
//
timeout: 2,

// #### `duration` Option ####
// `Number` (seconds), IN DEVELOPMENT
//
duration: undefined,

// #### `rebound` Option ####
// `Number` (seconds), since 1.1
//
Expand Down Expand Up @@ -798,7 +793,6 @@ jQuery.reel || (function($, window, document, undefined){
set(_center_, !!orbital);
set(_tempo_, opt.tempo / (reel.lazy? opt.laziness : 1));
set(_opening_ticks_, -1);
set(_ticks_, -1);
set(_annotations_, opt.annotations || $overlay.unbind(dot(_annotations_)) && {});
set(_backup_, {
src: src,
Expand Down Expand Up @@ -1050,7 +1044,6 @@ jQuery.reel || (function($, window, document, undefined){
var
speed= set(_speed_, speed || get(_speed_)),
duration= opt.duration,
ticks= duration && set(_ticks_, ceil(duration * leader(_tempo_))),
backwards= set(_backwards_, speed < 0),
playing= set(_playing_, !!speed),
stopped= set(_stopped_, !playing)
Expand Down Expand Up @@ -1613,11 +1606,8 @@ jQuery.reel || (function($, window, document, undefined){
backwards= bounce && set(_backwards_, !get(_backwards_))
var
direction= get(_cwish_) * negative_when(1, get(_backwards_)),
ticks= get(_ticks_),
step= (!get(_playing_) || !ticks ? velocity : abs(get(_speed_)) + velocity) / leader(_tempo_),
fraction= set(_fraction_, get(_fraction_) - step * direction),
ticks= !opt.duration ? ticks : ticks > 0 && set(_ticks_, ticks - 1)
!ticks && get(_playing_) && t.trigger('stop');
step= (!get(_playing_) ? velocity : abs(get(_speed_)) + velocity) / leader(_tempo_),
fraction= set(_fraction_, get(_fraction_) - step * direction)
},

// This handler performs the opening animation duty when during it the normal animation
Expand Down Expand Up @@ -2188,8 +2178,8 @@ jQuery.reel || (function($, window, document, undefined){
_frames_= 'frames', _hi_= 'hi', _hidden_= 'hidden', _image_= 'image', _images_= 'images', _opening_= 'opening', _opening_ticks_= _opening_+'_ticks',
_lo_= 'lo', _options_= 'options', _playing_= 'playing', _preloaded_= 'preloaded', _reeling_= 'reeling', _reeled_= 'reeled', _revolution_= 'revolution',
_revolution_y_= 'revolution_y', _row_= 'row', _rows_= 'rows', _spacing_= 'spacing', _speed_= 'speed', _stage_= 'stage',
_stitched_shift_= 'stitched_shift', _stitched_travel_= 'stitched_travel', _stopped_= 'stopped', _style_= 'style', _tempo_= 'tempo', _ticks_= 'ticks',
_tier_= 'tier', _velocity_= 'velocity', _vertical_= 'vertical',
_stitched_shift_= 'stitched_shift', _stitched_travel_= 'stitched_travel', _stopped_= 'stopped', _style_= 'style', _tempo_= 'tempo', _tier_= 'tier',
_velocity_= 'velocity', _vertical_= 'vertical',

// And the same goes for browser events too.
//
Expand Down
90 changes: 0 additions & 90 deletions test/unit/animation.js
Expand Up @@ -198,94 +198,4 @@

});

asyncTest( 'Duration: Animation duration expressed in ticks is reset on `play`', function()
{
expect(2);
var
ticks,
$reel= $('#image').reel({
speed: 1,
duration: 3
})

$reel.bind('loaded.test', function(){
$reel.trigger('play');
ticks= $reel.reel('ticks');
ok( ticks > 0, 'Positive `ticks`');
});

setTimeout(function(){
$reel.trigger('play');
equal( $reel.reel('ticks'), ticks, 'Positive `ticks` reset to same value on second `play`');
start();
}, 500);

});

asyncTest( 'Duration: Ticks not set when no `duration` given', function()
{
expect(1);
var
ticks,
$reel= $('#image').reel({
speed: 1
})

$reel.bind('loaded.test', function(){
$reel.trigger('play');
equal( $reel.reel('ticks'), -1, 'Default value signalizing no duration');
start();
});

});

asyncTest( 'Duration: Ticks count down to zero', function()
{
var
ticks_start,
expected,
samples= 5,
$reel= $('#image').reel({
speed: 1,
duration: 2
})

expect(samples);

$(document).bind('tick.reel.test', function(){
var
ticks= $reel.reel('ticks')

if (ticks != -1){
if (!ticks_start){
ticks_start= expected= ticks;
}else{
equal( ticks, --expected, ticks);
if (ticks <= ticks_start - samples) start();
}
}
})

});

asyncTest( 'Duration: Stop the animation after the given duration', function()
{
expect(2);
var
ticks,
$reel= $('#image').reel({
speed: 1,
duration: 0.5
})

$reel.bind('play.test', function(){
setTimeout(function(){
equal( $reel.reel('playing'), false, 'Not playing after');
equal( $reel.reel('stopped'), true, 'Is stopped');
start();
}, 1000);
});

});

})(jQuery);
5 changes: 1 addition & 4 deletions test/unit/api.js
Expand Up @@ -27,7 +27,7 @@
$.each($.reel.def, function(){ count++ });
expect(count + 7);

equal( count, 49, 'Total number of options');
equal( count, 48, 'Total number of options');

// Version 1.0 options
equal( $.reel.def.footage, 6, 'number of frames per line/column' );
Expand Down Expand Up @@ -88,9 +88,6 @@
equal( $.reel.def.scrollable, true, 'allow page scroll (allowed by default; applies only to touch devices)' );
equal( $.reel.def.steppable, true, 'allows to step the view (horizontally) by clicking on image' );
equal( $.reel.def.velocity, 0, 'initial velocity of user interaction; washes off quickly with `brake`' );

// Options in development
equal( $.reel.def.duration, undefined, 'duration of animation (in seconds)' );
});

test( 'jQuery of currently living instances is referenced as `$.reel.instances`', function()
Expand Down
1 change: 0 additions & 1 deletion test/unit/data.js
Expand Up @@ -50,7 +50,6 @@
stopped: 'Boolean',
style: 'Object', // (jQuery)
tempo: 'Number',
ticks: 'Number',
tier: 'Number',
velocity: 'Number',
vertical: 'Boolean'
Expand Down

0 comments on commit 51f0e74

Please sign in to comment.