Skip to content

Commit

Permalink
add FramesAnimation #611
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Jul 9, 2021
1 parent 6d32cce commit 86ef7c0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions js/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,26 @@
/* eslint-enable no-empty-function */
}

// -----------------------------------------------------------------------------------
class FramesAnimation extends $.terminal.Animation {
constructor(frames, ...args) {
super(...args);
this._i = 0;
this._frames = frames;
this._max = frames.length - 1;
}
render() {
if (this._i >= this._max) {
this._i = 0;
} else {
this._i++;
}
return this._frames[this._i];
}
}

$.terminal.Renderer = Renderer;
$.terminal.CanvasRenderer = CanvasRenderer;
$.terminal.Animation = Animation;
$.terminal.FramesAnimation = FramesAnimation;
});

0 comments on commit 86ef7c0

Please sign in to comment.