diff --git a/README.md b/README.md index e0f6119..9fdecc2 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ const reeller = new Reeller({ | :----------------------------------- | :------------------------------------------------------------------------------------------------------- | | `reeller.resume()` | Resumes movement. | | `reeller.pause()` | Pauses movement. | -| `reeller.reverse()` | Reverse movement. | +| `reeller.reverse([reversed=true])` | Set reversed moving. | | `reeller.invalidate()` | Refresh GSAP Timeline. | | `reeller.update()` | Calculates and sets the number of clones and update movement position. | | `reeller.refresh(update=true)` | Fully refresh and update all clones and position. Use this only after adding or removing original items. | diff --git a/src/module/Reeller.js b/src/module/Reeller.js index f1f6c87..86f515b 100644 --- a/src/module/Reeller.js +++ b/src/module/Reeller.js @@ -124,6 +124,7 @@ export default class Reeller extends Base { createTimeline() { this.tl = new this.gsap.timeline({ paused: this.options.paused, + reversed: this.options.reversed, repeat: -1, yoyo: !this.options.loop, onReverseComplete: function () { @@ -205,12 +206,14 @@ export default class Reeller extends Base { } /** - * Reverse moving. + * Set reversed moving. + * + * @param {boolean} [reversed] Is movement reversed? */ - reverse() { - this.paused = false; - this.tl.reverse(); - this.trigger('reverse'); + reverse(reversed = true) { + this.tl.reversed(reversed); + this.resume(); + this.trigger('reverse', reversed); } /**