Added readme
This commit is contained in:
		
							
								
								
									
										51
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,51 @@
 | 
			
		||||
# NTween
 | 
			
		||||
 | 
			
		||||
A simple library implementing tweens for [Odin language](https://odin-lang.org).
 | 
			
		||||
 | 
			
		||||
There's already [flux-tween](https://github.com/odin-lang/Odin/blob/aa36ae01cf4e4d665fb190b9f00237dfad9d21ee/core/math/ease/ease.odin#L359) 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 [examples](/examples). The callbacks one is not working right now but it's gonna be fixed.
 | 
			
		||||
 | 
			
		||||
### Very basic example
 | 
			
		||||
 | 
			
		||||
```odin
 | 
			
		||||
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()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
		Reference in New Issue
	
	Block a user