Fork raylib to expose GetGLProcAddress
@ -28,7 +28,7 @@ case $(uname) in
|
|||||||
# Copy the linux libraries into the project automatically.
|
# Copy the linux libraries into the project automatically.
|
||||||
if [ ! -d "linux" ]; then
|
if [ ! -d "linux" ]; then
|
||||||
mkdir linux
|
mkdir linux
|
||||||
cp -r $ROOT/vendor/raylib/linux/libraylib*.so* linux
|
cp -r libs/raylib/src/libraylib*.so* linux
|
||||||
cp -r libs/physfs/libphysfs.so* linux
|
cp -r libs/physfs/libphysfs.so* linux
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@ -36,7 +36,7 @@ esac
|
|||||||
|
|
||||||
# Build the game.
|
# Build the game.
|
||||||
echo "Building game$DLL_EXT"
|
echo "Building game$DLL_EXT"
|
||||||
odin build game -extra-linker-flags:"$EXTRA_LINKER_FLAGS" -define:RAYLIB_SHARED=true -define:GLFW_SHARED=true -define:PHYSFS_SHARED=true -define:TRACY_ENABLE=true -collection:libs=./libs -collection:common=./common -collection:game=./game -build-mode:dll -out:game_tmp$DLL_EXT -strict-style -vet -debug -o:speed
|
odin build game -extra-linker-flags:"$EXTRA_LINKER_FLAGS" -define:RAYLIB_SHARED=true -define:PHYSFS_SHARED=true -define:TRACY_ENABLE=true -collection:libs=./libs -collection:common=./common -collection:game=./game -build-mode:dll -out:game_tmp$DLL_EXT -strict-style -vet -debug -o:speed
|
||||||
|
|
||||||
# Need to use a temp file on Linux because it first writes an empty `game.so`, which the game will load before it is actually fully written.
|
# Need to use a temp file on Linux because it first writes an empty `game.so`, which the game will load before it is actually fully written.
|
||||||
mv game_tmp$DLL_EXT game$DLL_EXT
|
mv game_tmp$DLL_EXT game$DLL_EXT
|
||||||
|
@ -10,9 +10,9 @@ import "game:halfedge"
|
|||||||
import "game:physics/bvh"
|
import "game:physics/bvh"
|
||||||
import "game:physics/collision"
|
import "game:physics/collision"
|
||||||
import "libs:physfs"
|
import "libs:physfs"
|
||||||
|
import rl "libs:raylib"
|
||||||
|
import "libs:raylib/rlgl"
|
||||||
import "libs:tracy"
|
import "libs:tracy"
|
||||||
import rl "vendor:raylib"
|
|
||||||
import "vendor:raylib/rlgl"
|
|
||||||
|
|
||||||
_ :: math
|
_ :: math
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package debug
|
package debug
|
||||||
|
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
import "vendor:raylib/rlgl"
|
import "libs:raylib/rlgl"
|
||||||
|
|
||||||
int_to_color :: proc(num: i32) -> (color: rl.Color) {
|
int_to_color :: proc(num: i32) -> (color: rl.Color) {
|
||||||
x := int_hash(num)
|
x := int_hash(num)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package game
|
package game
|
||||||
|
|
||||||
import lg "core:math/linalg"
|
import lg "core:math/linalg"
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
|
|
||||||
update_free_look_camera :: proc(es: ^Editor_State) {
|
update_free_look_camera :: proc(es: ^Editor_State) {
|
||||||
input: rl.Vector2
|
input: rl.Vector2
|
||||||
|
@ -5,7 +5,7 @@ import "core:c"
|
|||||||
import "core:log"
|
import "core:log"
|
||||||
import "core:strings"
|
import "core:strings"
|
||||||
import "libs:physfs"
|
import "libs:physfs"
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
|
|
||||||
@(private = "file")
|
@(private = "file")
|
||||||
_ctx: runtime.Context
|
_ctx: runtime.Context
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
package game
|
package game
|
||||||
|
|
||||||
import "assets"
|
import "assets"
|
||||||
import "core:c"
|
|
||||||
import "core:fmt"
|
import "core:fmt"
|
||||||
import "core:hash"
|
import "core:hash"
|
||||||
import "core:log"
|
import "core:log"
|
||||||
@ -27,10 +26,10 @@ import "game:physics"
|
|||||||
import "game:physics/bvh"
|
import "game:physics/bvh"
|
||||||
import "game:physics/collision"
|
import "game:physics/collision"
|
||||||
import "game:render"
|
import "game:render"
|
||||||
|
import rl "libs:raylib"
|
||||||
|
import "libs:raylib/rlgl"
|
||||||
import "libs:tracy"
|
import "libs:tracy"
|
||||||
import "ui"
|
import "ui"
|
||||||
import rl "vendor:raylib"
|
|
||||||
import "vendor:raylib/rlgl"
|
|
||||||
|
|
||||||
PIXEL_WINDOW_HEIGHT :: 360
|
PIXEL_WINDOW_HEIGHT :: 360
|
||||||
|
|
||||||
@ -988,7 +987,6 @@ draw :: proc() {
|
|||||||
new_point_pos,
|
new_point_pos,
|
||||||
camera,
|
camera,
|
||||||
false,
|
false,
|
||||||
rl.GuiIconName.ICON_TARGET_POINT,
|
|
||||||
)) {
|
)) {
|
||||||
inject_at(&world.track.points, 0, new_point_pos)
|
inject_at(&world.track.points, 0, new_point_pos)
|
||||||
log.debugf("add point before 0")
|
log.debugf("add point before 0")
|
||||||
@ -1011,7 +1009,6 @@ draw :: proc() {
|
|||||||
new_point_pos,
|
new_point_pos,
|
||||||
camera,
|
camera,
|
||||||
false,
|
false,
|
||||||
rl.GuiIconName.ICON_TARGET_POINT,
|
|
||||||
)) {
|
)) {
|
||||||
inject_at(&world.track.points, points_len - 1 + 1, new_point_pos)
|
inject_at(&world.track.points, points_len - 1 + 1, new_point_pos)
|
||||||
log.debugf("add point before 0")
|
log.debugf("add point before 0")
|
||||||
@ -1026,7 +1023,7 @@ draw :: proc() {
|
|||||||
t := (f32(i) + 0.5) / f32(points_len)
|
t := (f32(i) + 0.5) / f32(points_len)
|
||||||
middle_pos := sample_spline(points[:], t)
|
middle_pos := sample_spline(points[:], t)
|
||||||
|
|
||||||
if (spline_handle(middle_pos, camera, false, rl.GuiIconName.ICON_TARGET_POINT)) {
|
if (spline_handle(middle_pos, camera, false)) {
|
||||||
inject_at(&world.track.points, i + 1, middle_pos)
|
inject_at(&world.track.points, i + 1, middle_pos)
|
||||||
log.debugf("add point after %d", i)
|
log.debugf("add point after %d", i)
|
||||||
}
|
}
|
||||||
@ -1074,7 +1071,6 @@ spline_handle :: proc(
|
|||||||
world_pos: rl.Vector3,
|
world_pos: rl.Vector3,
|
||||||
camera: rl.Camera,
|
camera: rl.Camera,
|
||||||
selected: bool,
|
selected: bool,
|
||||||
icon := rl.GuiIconName.ICON_NONE,
|
|
||||||
size := f32(20),
|
size := f32(20),
|
||||||
) -> (
|
) -> (
|
||||||
clicked: bool,
|
clicked: bool,
|
||||||
@ -1095,17 +1091,6 @@ spline_handle :: proc(
|
|||||||
|
|
||||||
|
|
||||||
rl.DrawCircleV(pos, size / 2, selected ? rl.BLUE : (is_hover ? rl.ORANGE : rl.WHITE))
|
rl.DrawCircleV(pos, size / 2, selected ? rl.BLUE : (is_hover ? rl.ORANGE : rl.WHITE))
|
||||||
if icon != .ICON_NONE {
|
|
||||||
rl.GuiDrawIcon(
|
|
||||||
icon,
|
|
||||||
c.int(pos.x) - 7,
|
|
||||||
c.int(pos.y) - 7,
|
|
||||||
1,
|
|
||||||
selected || is_hover ? rl.WHITE : rl.BLACK,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// rl.DrawRectangleV(pos, size, selected ? rl.BLUE : (is_hover ? rl.ORANGE : rl.WHITE))
|
|
||||||
|
|
||||||
return rl.IsMouseButtonPressed(.LEFT) && is_hover
|
return rl.IsMouseButtonPressed(.LEFT) && is_hover
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package halfedge
|
package halfedge
|
||||||
|
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
|
|
||||||
debug_draw_mesh_wires :: proc(mesh: Half_Edge_Mesh, color: rl.Color) {
|
debug_draw_mesh_wires :: proc(mesh: Half_Edge_Mesh, color: rl.Color) {
|
||||||
for _, f in mesh.faces {
|
for _, f in mesh.faces {
|
||||||
|
@ -9,7 +9,7 @@ import lg "core:math/linalg"
|
|||||||
import "core:mem"
|
import "core:mem"
|
||||||
import "game:debug"
|
import "game:debug"
|
||||||
import "libs:tracy"
|
import "libs:tracy"
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
|
|
||||||
_ :: log
|
_ :: log
|
||||||
_ :: rl
|
_ :: rl
|
||||||
|
@ -7,8 +7,8 @@ import "core:log"
|
|||||||
import lg "core:math/linalg"
|
import lg "core:math/linalg"
|
||||||
import "game:debug"
|
import "game:debug"
|
||||||
import "libs:tracy"
|
import "libs:tracy"
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
import "vendor:raylib/rlgl"
|
import "libs:raylib/rlgl"
|
||||||
|
|
||||||
_ :: fmt
|
_ :: fmt
|
||||||
_ :: log
|
_ :: log
|
||||||
|
@ -6,8 +6,8 @@ import "core:math"
|
|||||||
import lg "core:math/linalg"
|
import lg "core:math/linalg"
|
||||||
import "game:halfedge"
|
import "game:halfedge"
|
||||||
import "libs:tracy"
|
import "libs:tracy"
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
import "vendor:raylib/rlgl"
|
import "libs:raylib/rlgl"
|
||||||
|
|
||||||
_ :: math
|
_ :: math
|
||||||
_ :: rl
|
_ :: rl
|
||||||
|
@ -2,8 +2,8 @@ package collision
|
|||||||
|
|
||||||
import lg "core:math/linalg"
|
import lg "core:math/linalg"
|
||||||
import "game:debug"
|
import "game:debug"
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
import "vendor:raylib/rlgl"
|
import "libs:raylib/rlgl"
|
||||||
|
|
||||||
debug_plane_verts := []Vec3{{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}}
|
debug_plane_verts := []Vec3{{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}}
|
||||||
debug_plane_indices := []u16{0, 1, 2, 2, 3, 0}
|
debug_plane_indices := []u16{0, 1, 2, 2, 3, 0}
|
||||||
|
@ -8,8 +8,8 @@ import "game:debug"
|
|||||||
import "game:halfedge"
|
import "game:halfedge"
|
||||||
import "game:ui"
|
import "game:ui"
|
||||||
import "libs:tracy"
|
import "libs:tracy"
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
import "vendor:raylib/rlgl"
|
import "libs:raylib/rlgl"
|
||||||
|
|
||||||
_ :: log
|
_ :: log
|
||||||
_ :: math
|
_ :: math
|
||||||
|
@ -75,7 +75,7 @@ convex_container_destroy :: proc(container: ^Convex_Container) {
|
|||||||
// import "core:container/intrusive/list"
|
// import "core:container/intrusive/list"
|
||||||
// import "game:container/spanpool"
|
// import "game:container/spanpool"
|
||||||
// import "game:halfedge"
|
// import "game:halfedge"
|
||||||
// import rl "vendor:raylib"
|
// import rl "libs:raylib"
|
||||||
//
|
//
|
||||||
// Shape_Container :: struct {
|
// Shape_Container :: struct {
|
||||||
// shapes: spanpool.Span_Pool(Shape_Instance),
|
// shapes: spanpool.Span_Pool(Shape_Instance),
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
package render
|
package render
|
||||||
|
|
||||||
|
import rl "libs:raylib"
|
||||||
|
import rlgl "libs:raylib/rlgl"
|
||||||
import gl "vendor:OpenGL"
|
import gl "vendor:OpenGL"
|
||||||
import glfw "vendor:glfw"
|
|
||||||
import rl "vendor:raylib"
|
// Used by vendor:OpenGL
|
||||||
import rlgl "vendor:raylib/rlgl"
|
rlgl_set_proc_address :: proc(p: rawptr, name: cstring) {
|
||||||
|
(^rawptr)(p)^ = rl.GetGLProcAddress(name)
|
||||||
|
}
|
||||||
|
|
||||||
init :: proc() {
|
init :: proc() {
|
||||||
gl.load_up_to(3, 3, glfw.gl_set_proc_address)
|
gl.load_up_to(3, 3, rlgl_set_proc_address)
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_model :: proc(model: rl.Model, shader: rl.Shader, transform: rl.Matrix) {
|
draw_model :: proc(model: rl.Model, shader: rl.Shader, transform: rl.Matrix) {
|
||||||
|
@ -4,8 +4,8 @@ import "base:builtin"
|
|||||||
import "core:math"
|
import "core:math"
|
||||||
import lg "core:math/linalg"
|
import lg "core:math/linalg"
|
||||||
import "game:debug"
|
import "game:debug"
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
import "vendor:raylib/rlgl"
|
import "libs:raylib/rlgl"
|
||||||
|
|
||||||
SPLINE_SUBDIVS_U :: 1
|
SPLINE_SUBDIVS_U :: 1
|
||||||
SPLINE_SUBDIVS_V :: 16
|
SPLINE_SUBDIVS_V :: 16
|
||||||
|
@ -4,8 +4,8 @@ package ui
|
|||||||
|
|
||||||
import "core:log"
|
import "core:log"
|
||||||
import "core:strings"
|
import "core:strings"
|
||||||
import rl "vendor:raylib"
|
import rl "libs:raylib"
|
||||||
import "vendor:raylib/rlgl"
|
import "libs:raylib/rlgl"
|
||||||
|
|
||||||
to_rl_color :: proc(c: Color) -> rl.Color {
|
to_rl_color :: proc(c: Color) -> rl.Color {
|
||||||
return rl.Color{c.r, c.g, c.b, c.a}
|
return rl.Color{c.r, c.g, c.b, c.a}
|
||||||
|
223
libs/raylib/easings.odin
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
package raylib
|
||||||
|
|
||||||
|
import "core:math"
|
||||||
|
|
||||||
|
EaseLinearNone :: proc(t, b, c, d: f32) -> f32 { return (c*t/d + b) }
|
||||||
|
EaseLinearIn :: proc(t, b, c, d: f32) -> f32 { return (c*t/d + b) }
|
||||||
|
EaseLinearOut :: proc(t, b, c, d: f32) -> f32 { return (c*t/d + b) }
|
||||||
|
EaseLinearInOut :: proc(t, b, c, d: f32) -> f32 { return (c*t/d + b) }
|
||||||
|
|
||||||
|
// Sine Easing functions
|
||||||
|
EaseSineIn :: proc(t, b, c, d: f32) -> f32 { return (-c*math.cos(t/d*(PI/2.0)) + c + b) }
|
||||||
|
EaseSineOut :: proc(t, b, c, d: f32) -> f32 { return (c*math.sin(t/d*(PI/2.0)) + b) }
|
||||||
|
EaseSineInOut :: proc(t, b, c, d: f32) -> f32 { return (-c/2.0*(math.cos(PI*t/d) - 1.0) + b) }
|
||||||
|
|
||||||
|
// Circular Easing functions
|
||||||
|
EaseCircIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
return -c*(math.sqrt(1.0 - t*t) - 1.0) + b
|
||||||
|
}
|
||||||
|
EaseCircOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t = t/d - 1.0
|
||||||
|
return c*math.sqrt(1.0 - t*t) + b
|
||||||
|
}
|
||||||
|
EaseCircInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d/2.0
|
||||||
|
if t < 1.0 {
|
||||||
|
return -c/2.0*(math.sqrt(1.0 - t*t) - 1.0) + b
|
||||||
|
}
|
||||||
|
t -= 2.0
|
||||||
|
return c/2.0*(math.sqrt(1.0 - t*t) + 1.0) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cubic Easing functions
|
||||||
|
EaseCubicIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
return c*t*t*t + b
|
||||||
|
}
|
||||||
|
EaseCubicOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t = t/d - 1.0
|
||||||
|
return c*(t*t*t + 1.0) + b
|
||||||
|
}
|
||||||
|
EaseCubicInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d/2.0
|
||||||
|
if t < 1.0 {
|
||||||
|
return c/2.0*t*t*t + b
|
||||||
|
}
|
||||||
|
t -= 2.0
|
||||||
|
return c/2.0*(t*t*t + 2.0) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quadratic Easing functions
|
||||||
|
EaseQuadIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
return c*t*t + b
|
||||||
|
}
|
||||||
|
EaseQuadOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
return -c*t*(t - 2.0) + b
|
||||||
|
}
|
||||||
|
EaseQuadInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d/2.0
|
||||||
|
if t < 1 {
|
||||||
|
return ((c/2)*(t*t)) + b
|
||||||
|
}
|
||||||
|
return -c/2.0*(((t - 1.0)*(t - 3.0)) - 1.0) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exponential Easing functions
|
||||||
|
EaseExpoIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
return (t == 0.0) ? b : (c*math.pow(2.0, 10.0*(t/d - 1.0)) + b)
|
||||||
|
}
|
||||||
|
EaseExpoOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
return (t == d) ? (b + c) : (c*(-math.pow(2.0, -10.0*t/d) + 1.0) + b)
|
||||||
|
}
|
||||||
|
EaseExpoInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
if t == 0.0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
if t == d {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
t := t
|
||||||
|
t /= d/2.0
|
||||||
|
if t < 1.0 {
|
||||||
|
return c/2.0*math.pow(2.0, 10.0*(t - 1.0)) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
return c/2.0*(-math.pow(2.0, -10.0*(t - 1.0)) + 2.0) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Back Easing functions
|
||||||
|
EaseBackIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
s :: 1.70158
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
postFix := t
|
||||||
|
return (c*(postFix)*t*((s + 1.0)*t - s) + b)
|
||||||
|
}
|
||||||
|
|
||||||
|
EaseBackOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
s :: 1.70158
|
||||||
|
t = t/d - 1.0
|
||||||
|
return (c*(t*t*((s + 1.0)*t + s) + 1.0) + b)
|
||||||
|
}
|
||||||
|
|
||||||
|
EaseBackInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
s := f32(1.70158)
|
||||||
|
t /= d/2
|
||||||
|
if t < 1.0 {
|
||||||
|
s *= 1.525
|
||||||
|
return (c/2.0*(t*t*((s + 1.0)*t - s)) + b)
|
||||||
|
}
|
||||||
|
|
||||||
|
t -= 2
|
||||||
|
postFix := t
|
||||||
|
s *= 1.525
|
||||||
|
return (c/2.0*((postFix)*t*((s + 1.0)*t + s) + 2.0) + b)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bounce Easing functions
|
||||||
|
EaseBounceOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
switch {
|
||||||
|
case t < 1.0/2.75:
|
||||||
|
return (c*(7.5625*t*t) + b)
|
||||||
|
case t < 2.0/2.75:
|
||||||
|
t -= 1.5/2.75
|
||||||
|
postFix := t
|
||||||
|
return (c*(7.5625*(postFix)*t + 0.75) + b)
|
||||||
|
case t < 2.5/2.75:
|
||||||
|
t -= 2.25/2.75
|
||||||
|
postFix := t
|
||||||
|
return (c*(7.5625*(postFix)*t + 0.9375) + b)
|
||||||
|
case:
|
||||||
|
t -= 2.625/2.75
|
||||||
|
postFix := t
|
||||||
|
return (c*(7.5625*(postFix)*t + 0.984375) + b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EaseBounceIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
return c - EaseBounceOut(d - t, 0.0, c, d) + b
|
||||||
|
}
|
||||||
|
EaseBounceInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
if t < d/2.0 {
|
||||||
|
return EaseBounceIn(t*2.0, 0.0, c, d)*0.5 + b
|
||||||
|
} else {
|
||||||
|
return EaseBounceOut(t*2.0 - d, 0.0, c, d)*0.5 + c*0.5 + b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Elastic Easing functions
|
||||||
|
EaseElasticIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
if t == 0.0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
if t == 1.0 {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
|
||||||
|
p := d*0.3
|
||||||
|
a := c
|
||||||
|
s := p/4.0
|
||||||
|
t -= 1
|
||||||
|
postFix := a*math.pow(2.0, 10.0*t)
|
||||||
|
|
||||||
|
return -(postFix*math.sin((t*d-s)*(2.0*PI)/p )) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
EaseElasticOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
if t == 0.0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
if t == 1.0 {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
|
||||||
|
p := d*0.3
|
||||||
|
a := c
|
||||||
|
s := p/4.0
|
||||||
|
|
||||||
|
return a*math.pow(2.0,-10.0*t)*math.sin((t*d-s)*(2.0*PI)/p) + c + b
|
||||||
|
}
|
||||||
|
|
||||||
|
EaseElasticInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
if t == 0.0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
t := t
|
||||||
|
t /= d/2.0
|
||||||
|
if t == 2.0 {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
|
||||||
|
p := d*(0.3*1.5)
|
||||||
|
a := c
|
||||||
|
s := p/4.0
|
||||||
|
|
||||||
|
t -= 1
|
||||||
|
if t < 1.0 {
|
||||||
|
postFix := a*math.pow(2.0, 10.0*t)
|
||||||
|
return -0.5*(postFix*math.sin((t*d-s)*(2.0*PI)/p)) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
postFix := a*math.pow(2.0, -10.0*t)
|
||||||
|
return (postFix*math.sin((t*d-s)*(2.0*PI)/p)*0.5 + c + b)
|
||||||
|
}
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 173 KiB After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 403 KiB After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 320 KiB After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 217 KiB After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 417 KiB After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 295 KiB After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 311 KiB After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 434 KiB After Width: | Height: | Size: 131 B |