Skip to content

Commit

Permalink
Fix reversed moving option and improve reverse method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Drafteed committed Oct 9, 2023
1 parent a2f47b6 commit 2682069
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
13 changes: 8 additions & 5 deletions src/module/Reeller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 2682069

Please sign in to comment.