Skip to content

Instantly share code, notes, and snippets.

@luizbills
Last active November 30, 2023 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizbills/7c20ee99c5411d35764496cc685c7a51 to your computer and use it in GitHub Desktop.
Save luizbills/7c20ee99c5411d35764496cc685c7a51 to your computer and use it in GitHub Desktop.
Kaboom.js - Tween Yoyo (go and back)
async function tweenYoyo (from, to, dur, setValue, easeFunc = null, repeat = Infinity) {
while(repeat > 0) {
await tween(
from,
to,
dur,
setValue,
easeFunc
);
await tween(
to,
from,
dur,
setValue,
easeFunc
);
repeat--;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment