Skip to content

Commit

Permalink
Release v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ruyadorno committed May 1, 2016
1 parent 6c565e3 commit 2aec976
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SimpleSlider
============

version: 0.5.3-rc
version: 0.6.0

[![Build Status](https://travis-ci.org/ruyadorno/SimpleSlider.svg?branch=master)](https://travis-ci.org/ruyadorno/SimpleSlider)

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SimpleSlider",
"version": "0.5.3-rc",
"version": "0.6.0",
"description": "A simple javascript slider without any dependencies",
"homepage": "http://ruyadorno.github.io/SimpleSlider/",
"authors": [
Expand Down
39 changes: 26 additions & 13 deletions dist/simpleslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@

}

function anim(target, prop, unit, transitionDuration, startTime, elapsedTime, fromValue, toValue, easeFunc){
function anim(target, prop, unit, transitionDuration, startTime, elapsedTime, fromValue, toValue, easeFunc, scope, cb){

function loop() {
function loop(_cb) {

window.requestAnimationFrame(function requestAnimationFunction(time){

Expand All @@ -116,33 +116,35 @@
startTime = time;
}

anim(target, prop, unit, transitionDuration, startTime, time, fromValue, toValue, easeFunc);
anim(target, prop, unit, transitionDuration, startTime, time, fromValue, toValue, easeFunc, scope, _cb);

});
}

var newValue;

if (startTime === 0) {

return loop();

} else {
if (startTime > 0) {

newValue = easeFunc(elapsedTime - startTime, fromValue, toValue - fromValue, transitionDuration);

if (elapsedTime - startTime <= transitionDuration) {

target[prop] = newValue + unit;

loop();

} else {

target[prop] = (toValue) + unit;

if (scope && cb) {
cb.call(scope);
cb = null;
}
return;
}
}

loop(cb);

}

function startSlides(container, unit, startValue, visibleValue, transitionProperty) {
Expand Down Expand Up @@ -231,6 +233,7 @@
this.autoPlay = getdef(parseStringToBoolean(options.autoPlay), true);
this.ease = getdef(options.ease, SimpleSlider.defaultEase);
this.onChange = getdef(options.onChange, null);
this.onChangeEnd = getdef(options.onChangeEnd, null);

this.init();
};
Expand Down Expand Up @@ -355,9 +358,19 @@

};

SimpleSlider.prototype.startAnim = function(target, fromValue, toValue){
SimpleSlider.prototype.startAnim = function(target, fromValue, toValue, cb){

anim(target.style, this.trProp, this.unit, this.trTime * 1000, 0, 0, fromValue, toValue, this.ease);
anim(target.style, this.trProp, this.unit, this.trTime * 1000, 0, 0, fromValue, toValue, this.ease, this, cb);

};

SimpleSlider.prototype.endAnim = function() {

if (this.onChangeEnd ||
Object.prototype.toString.call(this.onChangeEnd) == '[object Function]') {

this.onChangeEnd(this.actualIndex, this.nextIndex());
}

};

Expand All @@ -373,7 +386,7 @@

this.inserted = manageInsertingSlideOrder(this.inserted, this.imgs[index]);

this.startAnim(this.imgs[index], this.startVal, this.visVal);
this.startAnim(this.imgs[index], this.startVal, this.visVal, this.endAnim);

};

Expand Down
2 changes: 1 addition & 1 deletion dist/simpleslider.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-slider",
"version": "0.5.3-rc",
"version": "0.6.0",
"description": "A simple javascript slider without any dependencies",
"scripts": {
"test": "grunt jasmine:dev"
Expand Down

0 comments on commit 2aec976

Please sign in to comment.