Nefrace 7136c68f3e | ||
---|---|---|
examples | ||
README.md | ||
ntween.odin |
README.md
NTween
A simple library implementing tweens for Odin language.
There's already flux-tween in the standard library, but it was somewhat difficult to understand at first so I've made one myself.
Features
- basic float values tweening
- array values tweening (vec2 and vec3 for example)
- supports easings from
core:math/ease
- callbacks after completion
Installing
You can clone this repo inside of your project and then just import the library using import ntween
How it works?
Check out examples
folder. The callbacks one is not working right now but it's gonna be fixed.
Very basic example
package main
import nt "ntween"
import rl "vendor:raylib"
import "core:math/ease"
main :: proc() {
rl.InitWindow(800, 600, "hellope, tweens!")
tw := nt.init(f32)
pos : f32 = 100.0
nt.animate(&tw, &pos, 700, 2, ease.Ease.Bounce_Out)
for !rl.WindowShouldClose() {
delta := rl.GetFrameTime()
nt.process(&tw, delta)
rl.BeginDrawing()
rl.ClearBackground(rl.BLACK)
rl.DrawRectangleV({pos, 100}, {30, 30}, rl.WHITE)
rl.EndDrawing()
}
}