summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-12-12 10:03:02 -0200
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-12-19 10:56:47 -0200
commitdb643a9524eda876241b9541d4d62b8619f5749f (patch)
tree9482bd9c448bdcd0fa3bf35db4c0fc018cd344ef
parent2b05a9c337b08974ced4bb609a25f4158817ea8d (diff)
downloadmullvadvpn-db643a9524eda876241b9541d4d62b8619f5749f.tar.xz
mullvadvpn-db643a9524eda876241b9541d4d62b8619f5749f.zip
Remove animation support for alternation
-rw-r--r--gui/packages/desktop/src/main/keyframe-animation.js19
-rw-r--r--gui/packages/desktop/test/keyframe-animation.spec.js41
2 files changed, 1 insertions, 59 deletions
diff --git a/gui/packages/desktop/src/main/keyframe-animation.js b/gui/packages/desktop/src/main/keyframe-animation.js
index 8a51fb0071..e3ed363295 100644
--- a/gui/packages/desktop/src/main/keyframe-animation.js
+++ b/gui/packages/desktop/src/main/keyframe-animation.js
@@ -17,7 +17,6 @@ export default class KeyframeAnimation {
_speed: number = 200; // ms
_repeat: boolean = false;
_reverse: boolean = false;
- _alternate: boolean = false;
_onFrame: ?OnFrameFn;
_onFinish: ?OnFinishFn;
@@ -70,15 +69,6 @@ export default class KeyframeAnimation {
return this._reverse;
}
- // alternates the animation direction when it reaches the end
- // only for repeating animations
- set alternate(newValue: boolean) {
- this._alternate = !!newValue;
- }
- get alternate(): boolean {
- return this._alternate;
- }
-
get nativeImages(): Array<NativeImage> {
return this._nativeImages.slice();
}
@@ -225,14 +215,7 @@ export default class KeyframeAnimation {
return;
}
- // change animation direction if marked for alternation
- if (this._alternate) {
- this._reverse = !this._reverse;
-
- this._currentFrame = this._nextFrame(this._currentFrame, this._frameRange, this._reverse);
- } else {
- this._currentFrame = this._frameRange[this._reverse ? 1 : 0];
- }
+ this._currentFrame = this._frameRange[this._reverse ? 1 : 0];
} else {
this._currentFrame = this._nextFrame(this._currentFrame, this._frameRange, this._reverse);
}
diff --git a/gui/packages/desktop/test/keyframe-animation.spec.js b/gui/packages/desktop/test/keyframe-animation.spec.js
index 84bfb51277..ddf81c96d2 100644
--- a/gui/packages/desktop/test/keyframe-animation.spec.js
+++ b/gui/packages/desktop/test/keyframe-animation.spec.js
@@ -224,45 +224,4 @@ describe('lib/keyframe-animation', function() {
animation.reverse = true;
animation.play();
});
-
- it('should alternate sequence', (done) => {
- const seq = [];
- const animation = newAnimation();
- const expectedFrames = [0, 1, 2, 3, 4, 3, 2, 1, 0];
-
- animation.onFrame = () => {
- if (seq.length === expectedFrames.length) {
- animation.stop();
- expect(seq).to.be.deep.equal(expectedFrames);
- done();
- } else {
- seq.push(animation._currentFrame);
- }
- };
-
- animation.repeat = true;
- animation.alternate = true;
- animation.play();
- });
-
- it('should alternate reverse sequence', (done) => {
- const seq = [];
- const animation = newAnimation();
- const expectedFrames = [4, 3, 2, 1, 0, 1, 2, 3, 4];
-
- animation.onFrame = () => {
- if (seq.length === expectedFrames.length) {
- animation.stop();
- expect(seq).to.be.deep.equal(expectedFrames);
- done();
- } else {
- seq.push(animation._currentFrame);
- }
- };
-
- animation.repeat = true;
- animation.reverse = true;
- animation.alternate = true;
- animation.play();
- });
});