diff options
author | Rémi Tétreault <tetreault.remi@gmail.com> | 2017-02-25 13:23:23 -0500 |
---|---|---|
committer | Rémi Tétreault <tetreault.remi@gmail.com> | 2017-02-25 16:59:55 -0500 |
commit | 6327512f1afe304891f5fb5e59afc15e55d70ba1 (patch) | |
tree | 8a0e8c2acb5e421c76ef6686ce9feeccdebe4779 /src | |
parent | ef7451dd477e1835d92f3de493029225fa55d603 (diff) | |
download | svg.js-6327512f1afe304891f5fb5e59afc15e55d70ba1.tar.gz svg.js-6327512f1afe304891f5fb5e59afc15e55d70ba1.zip |
Add tests for the method atEnd of the FX module
List of changes:
* Add tests for atEnd for the case the animation is in a infinite loop
* Fix a bug in atEnd that was uncovered by the new tests
* Fix the indentation of the methods atStart and atEnd
* Improve the comments of some of the others tests of atEnd
Diffstat (limited to 'src')
-rw-r--r-- | src/fx.js | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -301,22 +301,24 @@ SVG.FX = SVG.invent({ // set the internal animation pointer at the start position, before any loops, and updates the visualisation , atStart: function() { - return this.at(0, true) - } + return this.at(0, true) + } // set the internal animation pointer at the end position, after all the loops, and updates the visualisation , atEnd: function() { - if (this.situation.loops === true) { - // If in a infinite loop, we end the current iteration - return this.at(this.situation.loop+1, true) - } else if(typeof this.situation.loops == 'number') { - // If performing a finite number of loops, we go after all the loops - return this.at(this.situation.loops, true) - } else { - // If no loops, we just go at the end - return this.at(1, true) + if (this.situation.loops === true) { + // If in a infinite loop, we end the current iteration + this.situation.loops = this.situation.loop + 1 + } + + if(typeof this.situation.loops == 'number') { + // If performing a finite number of loops, we go after all the loops + return this.at(this.situation.loops, true) + } else { + // If no loops, we just go at the end + return this.at(1, true) + } } - } // set the internal animation pointer to the specified position and updates the visualisation // if isAbsPos is true, pos is treated as an absolute position |