draw animation frames for whip attack

This commit is contained in:
2025-02-28 12:03:23 +00:00
parent 0385366fce
commit 321200139b
4 changed files with 168 additions and 0 deletions

163
fcore/box.sml Normal file
View File

@@ -0,0 +1,163 @@
structure Box =
struct
fun lerp (startX, startY, drawWidth, drawHeight, windowWidth, windowHeight) : Real32.real vector =
let
val endY = windowHeight - startY
val startY = windowHeight - (startY + drawHeight)
val endX = startX + drawWidth
val windowHeight = windowHeight / 2.0
val windowWidth = windowWidth / 2.0
in
#[ (((startX * (1.0 - 0.125)) + (endX * 0.125)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
1.0,
1.0,
1.0,
(((startX * (1.0 - 0.875)) + (endX * 0.875)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.125)) + (endY * 0.125)) / windowHeight) - 1.0,
1.0,
1.0,
1.0,
(((startX * (1.0 - 0.875)) + (endX * 0.875)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
1.0,
1.0,
1.0,
(((startX * (1.0 - 0.875)) + (endX * 0.875)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.125)) + (endY * 0.125)) / windowHeight) - 1.0,
1.0,
1.0,
1.0,
(((startX * (1.0 - 0.125)) + (endX * 0.125)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.125)) + (endY * 0.125)) / windowHeight) - 1.0,
1.0,
1.0,
1.0,
(((startX * (1.0 - 0.125)) + (endX * 0.125)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
1.0,
1.0,
1.0,
(((startX * (1.0 - 0.875)) + (endX * 0.875)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.0)) + (endY * 0.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.125)) + (endX * 0.125)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.125)) + (endY * 0.125)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.875)) + (endX * 0.875)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.125)) + (endY * 0.125)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.125)) + (endX * 0.125)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.125)) + (endY * 0.125)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.125)) + (endX * 0.125)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.0)) + (endY * 0.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.875)) + (endX * 0.875)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.0)) + (endY * 0.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 1.0)) + (endX * 1.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.0)) + (endY * 0.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.875)) + (endX * 0.875)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 1.0)) + (endX * 1.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.875)) + (endX * 0.875)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.875)) + (endX * 0.875)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.0)) + (endY * 0.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 1.0)) + (endX * 1.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.0)) + (endY * 0.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.125)) + (endX * 0.125)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.0)) + (endY * 0.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.0)) + (endX * 0.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.125)) + (endX * 0.125)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.0)) + (endX * 0.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.0)) + (endX * 0.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.0)) + (endY * 0.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.125)) + (endX * 0.125)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.0)) + (endY * 0.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 1.0)) + (endX * 1.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.0)) + (endX * 0.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.0)) + (endX * 0.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 1.0)) + (endY * 1.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 0.0)) + (endX * 0.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 1.0)) + (endY * 1.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 1.0)) + (endX * 1.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 1.0)) + (endY * 1.0)) / windowHeight) - 1.0,
0.0,
0.0,
0.0,
(((startX * (1.0 - 1.0)) + (endX * 1.0)) / windowWidth) - 1.0,
(((startY * (1.0 - 0.875)) + (endY * 0.875)) / windowHeight) - 1.0,
0.0,
0.0,
0.0
]
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,4 @@
structure Whip =
struct
type box = {x: int, y: int, size: int}
end