Factorio Prototype DocsVersion 1.1.107

AnimationPrototype - 'animation'

Specifies an animation that can be used with LuaRendering::draw_animation at runtime.

Properties

type :: "animation"
name :: string

Name of the animation. [...]

Name of the animation. [...]

layers optional :: array[Animation]

If this property is present, all Animation definitions have to be placed as entries in the array, and they will all be loaded from there. [...]

If this property is present, all Animation definitions have to be placed as entries in the array, and they will all be loaded from there. [...]

filename optional :: FileName

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

hr_version optional :: Animation

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

priority optional :: SpritePriority

Only loaded if layers is not defined.

Only loaded if layers is not defined.

flags optional :: SpriteFlags

Only loaded if layers is not defined.

Only loaded if layers is not defined.

size optional :: SpriteSizeType or {SpriteSizeType, SpriteSizeType}

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

width optional :: SpriteSizeType

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

height optional :: SpriteSizeType

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

x optional :: SpriteSizeType

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

y optional :: SpriteSizeType

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

position optional :: {SpriteSizeType, SpriteSizeType}

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

shift optional :: Vector

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

scale optional :: double

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

draw_as_shadow optional :: bool

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

draw_as_glow optional :: bool

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

draw_as_light optional :: bool

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

mipmap_count optional :: uint8

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

apply_runtime_tint optional :: bool

Only loaded if layers is not defined.

Only loaded if layers is not defined.

tint optional :: Color

Only loaded if layers is not defined.

Only loaded if layers is not defined.

blend_mode optional :: BlendMode

Only loaded if layers is not defined.

Only loaded if layers is not defined.

load_in_minimal_mode optional :: bool

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

premul_alpha optional :: bool

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

generate_sdf optional :: bool

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

run_mode optional :: "forward" or "backward" or "forward-then-backward"

Only loaded if layers is not defined.

Only loaded if layers is not defined.

frame_count optional :: uint32

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

line_length optional :: uint32

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

animation_speed optional :: float

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

max_advance optional :: float

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

repeat_count optional :: uint8

Only loaded if layers is not defined. [...]

Only loaded if layers is not defined. [...]

dice optional :: uint8

Only loaded if layers is not defined.

Only loaded if layers is not defined.

dice_x optional :: uint8

Only loaded if layers is not defined.

Only loaded if layers is not defined.

dice_y optional :: uint8

Only loaded if layers is not defined.

Only loaded if layers is not defined.

frame_sequence optional :: AnimationFrameSequence

Only loaded if layers is not defined.

Only loaded if layers is not defined.

stripes optional :: array[Stripe]

Only loaded if layers is not defined.

Only loaded if layers is not defined.

Properties

type :: "animation"

name :: string

Name of the animation. Can be used with LuaRendering::draw_animation at runtime.

layers :: array[Animation] optional

If this property is present, all Animation definitions have to be placed as entries in the array, and they will all be loaded from there. layers may not be an empty table. Each definition in the array may also have the layers property.

animation_speed and max_advance of the first layer are used for all layers. All layers will run at the same speed.

If this property is present, all other properties besides name and type are ignored.

filename :: FileName optional

Only loaded if layers is not defined. Mandatory if stripes is not defined.

The path to the sprite file to use.

hr_version :: Animation optional

Only loaded if layers is not defined.

If this property exists and high resolution sprites are turned on, this is used to load the Animation.

priority :: SpritePriority optional

Default: "medium"

Only loaded if layers is not defined.

flags :: SpriteFlags optional

Only loaded if layers is not defined.

size :: SpriteSizeType or {SpriteSizeType, SpriteSizeType} optional

Only loaded if layers is not defined.

The width and height of one frame. If this is a tuple, the first member of the tuple is the width and the second is the height. Otherwise the size is both width and height. Width and height may only be in the range of 0-8192.

width :: SpriteSizeType optional

Only loaded if layers is not defined. Mandatory if size is not defined.

Width of one frame in pixels, from 0-8192.

height :: SpriteSizeType optional

Only loaded if layers is not defined. Mandatory if size is not defined.

Height of one frame in pixels, from 0-8192.

x :: SpriteSizeType optional

Default: 0

Only loaded if layers is not defined.

Horizontal position of the animation in the source file in pixels.

y :: SpriteSizeType optional

Default: 0

Only loaded if layers is not defined.

Vertical position of the animation in the source file in pixels.

position :: {SpriteSizeType, SpriteSizeType} optional

Only loaded if layers is not defined.

Loaded only when x and y are both 0. The first member of the tuple is x and the second is y.

shift :: Vector optional

Default: {0, 0}

Only loaded if layers is not defined.

The shift in tiles. util.by_pixel() can be used to divide the shift by 32 which is the usual pixel height/width of 1 tile in normal resolution. Note that 32 pixel tile height/width is not enforced anywhere - any other tile height or width is also possible.

scale :: double optional

Default: 1

Only loaded if layers is not defined.

Values other than 1 specify the scale of the sprite on default zoom. A scale of 2 means that the picture will be two times bigger on screen (and thus more pixelated).

draw_as_shadow :: bool optional

Default: false

Only loaded if layers is not defined.

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true. This takes precedence over draw_as_glow and draw_as_light.

draw_as_glow :: bool optional

Default: false

Only loaded if layers is not defined.

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true. This takes precedence over draw_as_light.

Draws first as a normal sprite, then again as a light layer. See https://forums.factorio.com/91682.

draw_as_light :: bool optional

Default: false

Only loaded if layers is not defined.

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true.

mipmap_count :: uint8 optional

Default: 0

Only loaded if layers is not defined.

Only loaded if this is an icon, that is it has the flag "group=icon" or "group=gui".

Note that mipmap_count doesn't make sense in an animation, as it is not possible to layout mipmaps in a way that would load both the animation and the mipmaps correctly (besides animations with just one frame). See here.

apply_runtime_tint :: bool optional

Default: false

Only loaded if layers is not defined.

tint :: Color optional

Default: {r=1, g=1, b=1, a=1}

Only loaded if layers is not defined.

blend_mode :: BlendMode optional

Default: "normal"

Only loaded if layers is not defined.

load_in_minimal_mode :: bool optional

Default: false

Only loaded if layers is not defined.

Minimal mode is entered when mod loading fails. You are in it when you see the gray box after (part of) the loading screen that tells you a mod error (Example). Modders can ignore this property.

premul_alpha :: bool optional

Default: true

Only loaded if layers is not defined.

Whether alpha should be pre-multiplied.

generate_sdf :: bool optional

Default: false

Only loaded if layers is not defined.

Unused.

run_mode :: "forward" or "backward" or "forward-then-backward" optional

Default: "forward"

Only loaded if layers is not defined.

frame_count :: uint32 optional

Default: 1

Only loaded if layers is not defined.

Can't be 0.

line_length :: uint32 optional

Default: 0

Only loaded if layers is not defined.

Once the specified number of pictures is loaded, other pictures are loaded on other line. This is to allow having longer animations in matrix, to input files with too high width. The game engine limits the width of any input files to 8192px, so it is compatible with most graphics cards. 0 means that all the pictures are in one horizontal line.

animation_speed :: float optional

Default: 1

Only loaded if layers is not defined.

Modifier of the animation playing speed, the default of 1 means one animation frame per tick (60 fps). The speed of playing can often vary depending on the usage (output of steam engine for example). Has to be greater than 0.

If layers are used, the animation_speed only has to be defined in one layer. All layers will run at the same speed.

max_advance :: float optional

Default: MAX_FLOAT

Only loaded if layers is not defined.

If layers are used, max_advance of the first layer is used for all layers.

Maximum amount of frames the animation can move forward in one update.

repeat_count :: uint8 optional

Default: 1

Only loaded if layers is not defined.

How many times to repeat the animation to complete an animation cycle. E.g. if one layer is 10 frames, a second layer of 1 frame would need repeat_count = 10 to match the complete cycle.

dice :: uint8 optional

Only loaded if layers is not defined.

dice_x :: uint8 optional

Only loaded if layers is not defined.

dice_y :: uint8 optional

Only loaded if layers is not defined.

frame_sequence :: AnimationFrameSequence optional

Only loaded if layers is not defined.

stripes :: array[Stripe] optional

Only loaded if layers is not defined.

Prototypes

Types