From 9614049610147c1896d5538b7977373ff367bb46 Mon Sep 17 00:00:00 2001 From: Synthasmagoria Date: Sun, 30 Aug 2026 18:16:12 +0200 Subject: [PATCH] Reprogrammed rectangle drawing to be on top of everything --- default | Bin 182 -> 146 bytes src/animation.odin | 38 +++++++++++++++++++------------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/default b/default index 7e73b9688c614c672eab5b835e54ab22ae80997b..84c6bc7211dcdd9db8b78a69cb56dd5a5ff7b0ae 100755 GIT binary patch delta 14 VcmdnSIEitB5(_f}1H(kG8~_@u14{q^ delta 50 icmbQlxQ%gwk_HO{2sGG(DTW3oC=KMp*bw=NYB>P8qX!KD diff --git a/src/animation.odin b/src/animation.odin index acf2ed5..2e14160 100644 --- a/src/animation.odin +++ b/src/animation.odin @@ -128,7 +128,7 @@ rectangle_corners_get_triangles :: proc (corners: RectangleCorners) -> [2]tri2 { collection = &corners_slice, len = proc(it: sort.Interface) -> int { array := (cast(^[]AngleAndReference)it.collection)^ - return 4 + return len(array) }, less = proc(it: sort.Interface, i, j: int) -> bool { array := (cast(^[]AngleAndReference)it.collection)^ @@ -213,29 +213,29 @@ animation_draw :: proc(animation: Animation, global_transform: mat3, temp_alloca switch animation.type { case .Rectangle: - shape := animation.shapes.rectangle - draw_animation_rectangle_corners(rectangle_corners_transform_mat3(global_transform, shape), ANIMATION_COLOR_ORIGIN) + rectangles := make([]RectangleCorners, animation.matrix_count + 1, temp_allocator) + rectangles[0] = rectangle_corners_transform_mat3(global_transform, animation.shapes.rectangle) transform := linalg.identity(mat3) matrices := slice.reinterpret([]mat3, animation.matrices[:animation.matrix_count * 9]) for mat, i in matrices { - animation_progress := f32(i + 1) / f32(animation.matrix_count) - transform_previous := transform transform *= mat - shape_next := rectangle_corners_transform_mat3(transform, shape) - shape_next_world := rectangle_corners_transform_mat3(global_transform, shape_next) - shape_next_color := linalg.lerp(color_origin, color_end, animation_progress) - draw_animation_rectangle_corners(shape_next_world, rl.Color(shape_next_color)) - - if f32(i) == math.floor(animation.matrix_index) { - animation_current_progress_fraction := ease.ease(animation.ease, fract(animation.matrix_index)) - animation_current_progress := (math.trunc(animation.matrix_index) + animation_current_progress_fraction) / f32(animation.matrix_count) - shape_previous := rectangle_corners_transform_mat3(transform_previous, shape) - shape_previous_world := rectangle_corners_transform_mat3(global_transform, shape_previous) - shape_current_world := rectangle_corners_lerp(shape_previous_world, shape_next_world, animation_current_progress_fraction) - shape_current_color := linalg.lerp(color_origin, color_end, animation_current_progress) - draw_animation_rectangle_corners(shape_current_world, rl.Color(shape_current_color)) - } + rectangle_transformed := rectangle_corners_transform_mat3(transform, animation.shapes.rectangle) + rectangles[i + 1] = rectangle_corners_transform_mat3(global_transform, rectangle_transformed) } + for rectangle, i in rectangles { + color := linalg.lerp(color_origin, color_end, f32(i) / f32(animation.matrix_count)) + draw_animation_rectangle_corners(rectangle, rl.Color(color)) + } + + animation_progress := math.clamp(animation.matrix_index, 0.0, f32(animation.matrix_count - 1)) + animation_progress_frame := ease.ease(animation.ease, fract(animation.matrix_index)) + animation_progress_total := animation_progress + animation_progress_frame + animation_progress_fraction := animation_progress_total / f32(animation.matrix_count) + rectangle_previous := rectangles[i32(animation_progress)] + rectangle_next := rectangles[i32(animation_progress + 1)] + rectangle_current := rectangle_corners_lerp(rectangle_previous, rectangle_next, animation_progress_frame) + rectangle_current_color := linalg.lerp(color_origin, color_end, animation_progress_fraction) + draw_animation_rectangle_corners(rectangle_current, rl.Color(rectangle_current_color)) } }