summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2016-03-28 17:49:08 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2016-03-29 00:18:14 +0200
commit541c6ecc8103313ed0a15a0b4d2593757b231e99 (patch)
treefe4dc1591c9ddc5931458f2757ab3a81c99fb510 /src
parent1d0bb73385877d4ae14b175acd78565c48c4092d (diff)
downloadsvg.js-541c6ecc8103313ed0a15a0b4d2593757b231e99.tar.gz
svg.js-541c6ecc8103313ed0a15a0b4d2593757b231e99.zip
fix finishing up correctly with even loops, readme
Diffstat (limited to 'src')
-rw-r--r--src/fx.js32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/fx.js b/src/fx.js
index c442884..a0ab8c4 100644
--- a/src/fx.js
+++ b/src/fx.js
@@ -22,7 +22,7 @@ SVG.Situation = SVG.invent({
this.start = +new Date() + this.delay
this.finish = this.start + this.duration
this.ease = o.ease
-
+
this.loop = false
this.loops = false
@@ -285,15 +285,16 @@ SVG.FX = SVG.invent({
if(jumpToEnd){
this.situation.loop = false
-
+
// TODO: test this
if(this.situation.loops % 2 == 0 && this.situation.reversing){
- this.situation.reverse = true
+ console.log('EVEN LOOPS')
+ this.situation.reversed = true
}
-
+
console.log('go')
this.at(1)
-
+
}
this.stopAnimFrame()
@@ -323,10 +324,7 @@ SVG.FX = SVG.invent({
while(this.dequeue().situation && this.stop(true, false));
this.clearQueue().clearCurrent()
-
- // fire allfinished manually because the normal routine wont fire it
- //this.target().fire('allfinished') // TODO: Here we stoped working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
+
return this
}
@@ -471,12 +469,12 @@ SVG.FX = SVG.invent({
, step: function(ignoreTime){
console.log('here we are: step', ignoreTime, this.pos)
-
+
// convert current time to position
if(!ignoreTime) this.pos = this.timeToPos(+new Date)
if(this.pos >= 1 && (this.situation.loop === true || (typeof this.situation.loop == 'number' && --this.situation.loop))){
-
+
if(this.situation.reversing){
this.situation.reversed = !this.situation.reversed
}
@@ -501,21 +499,21 @@ SVG.FX = SVG.invent({
}
console.log('firing during now:', this.active)
-
+
// fire during callback with position, eased position and current situation as parameter
if(this.active) this.target().fire('during', {pos: this.pos, eased: eased, fx: this, situation: this.situation})
console.log('fired')
-
+
// the user may call stop or finish in the during callback
// so make sure that we still have a valid situation
// FIXME: callbacks not getting called!
if(!this.situation){
return this
}
-
+
console.log('still there?')
-
+
// apply the actual animation to every property
this.eachAt()
@@ -523,7 +521,7 @@ SVG.FX = SVG.invent({
if((this.pos == 1 && !this.situation.reversed) || (this.situation.reversed && this.pos == 0)){
console.log('finish up animation')
-
+
// stop animation callback
cancelAnimationFrame(this.animationFrame)
@@ -555,7 +553,7 @@ SVG.FX = SVG.invent({
// calculates the step for every property and calls block with it
, eachAt: function(){
var i, at, self = this, target = this.target(), c = this.situation
-
+
// apply animations which can be called trough a method
for(i in c.animations){