documentation pass before moving on
This commit is contained in:
parent
c6923a3133
commit
ddf3590c96
17 changed files with 84 additions and 44 deletions
|
|
@ -1,12 +1,19 @@
|
|||
class_name AnimationStrip
|
||||
extends Resource
|
||||
## A texture sliced into a number of horizontal frames and played at a
|
||||
## certain fps.
|
||||
|
||||
|
||||
## Texture containing all frames in one row.
|
||||
@export var texture: Texture
|
||||
## Number of frames to slice the texture into.
|
||||
@export var frames: int = 1
|
||||
## How many frames should be displayed per second.
|
||||
@export var fps: float = 1.0
|
||||
|
||||
|
||||
## Draws the frame that should be visible at a given point in time. This must be
|
||||
## called during the [method CanvasItem._draw] of [param canvas_item].
|
||||
func draw(canvas_item: CanvasItem, time: float, modulate: Color = Color.WHITE) -> void:
|
||||
var frame_size = Vector2((texture.get_width() / frames), float(texture.get_height()))
|
||||
var current_frame = fmod(floorf(time * fps), frames)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue