From 5c7cdeded824fbf6502d1a44f8634cbf4baf1295 Mon Sep 17 00:00:00 2001 From: Insality Date: Wed, 31 Jul 2024 22:19:25 +0300 Subject: [PATCH] Update README and tests --- README.md | 1 + test/test_tweener.lua | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/README.md b/README.md index 8d4dc27..ade6613 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ - **Easing Functions**: Provides a set of easing functions for different types of easings. - **Custom Update Frequency**: Option to define update frequency for the tween. - **Callbacks**: Callbacks for each tween update. +- **Custom Easings**: Support for custom easing functions. ## Setup diff --git a/test/test_tweener.lua b/test/test_tweener.lua index 828bcb2..34749b3 100644 --- a/test/test_tweener.lua +++ b/test/test_tweener.lua @@ -32,5 +32,51 @@ return function() assert(tweener.ease(easing, 0, 100, 1, 0) == 0) assert(tweener.ease(easing, 0, 100, 1, 2) == 0) end) + + it("Tweener should support each Defold tweening", function() + local epsilon = 0.0001 + assert(tweener.ease(go.EASING_INBACK, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INBOUNCE, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INCIRC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INCUBIC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INELASTIC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INEXPO, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INOUTBACK, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INOUTBOUNCE, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INOUTCIRC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INOUTCUBIC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INOUTELASTIC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INOUTEXPO, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INOUTQUAD, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INOUTQUART, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INOUTQUINT, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INOUTSINE, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INQUAD, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INQUART, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INQUINT, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_INSINE, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_LINEAR, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTBACK, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTBOUNCE, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTCIRC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTCUBIC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTELASTIC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTEXPO, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTINBACK, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTINBOUNCE, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTINCIRC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTINCUBIC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTINELASTIC, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTINEXPO, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTINQUAD, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTINQUART, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTINQUINT, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTINSINE, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTQUAD, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTQUART, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTQUINT, 0, 1, 1, 0) < epsilon) + assert(tweener.ease(go.EASING_OUTSINE, 0, 1, 1, 0) < epsilon) + + end) end) end