Skip to content

Commit

Permalink
Update README and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Insality committed Jul 31, 2024
1 parent c9fa989 commit 5c7cded
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
46 changes: 46 additions & 0 deletions test/test_tweener.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5c7cded

Please sign in to comment.