Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Prototype Docs Version 2.0.77

# Animation - Prototype Docs

## Animation :: struct Example code

Specifies an animation that can be used in the game.

Note that if any frame of the animation is specified from the same source as any other Sprite or frame of other animation, it will be shared.

Inherits from AnimationParameters « SpriteParameters « SpriteSource

## Properties

- default
- sorted

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. [...]
stripes optional | :: array[Stripe] | Only loaded if `layers` is not defined.
Only loaded if `layers` is not defined.
filenames optional | :: array[FileName] | Only loaded if neither `layers` nor `stripes` are defined.
Only loaded if neither `layers` nor `stripes` are defined.
slice optional | :: uint32 | Only loaded if `layers` is not defined and if `filenames` is defined.
Only loaded if `layers` is not defined and if `filenames` is defined.
lines_per_file optional | :: uint32 | Only loaded if `layers` is not defined. [...]
Only loaded if `layers` is not defined. [...]

Inherited from AnimationParameters

run_mode optional | :: AnimationRunMode |
frame_count optional | :: uint32 | Can't be `0`.
Can't be `0`.
line_length optional | :: uint32 | Specifies how many pictures are on each horizontal line in the image file. [...]
Specifies how many pictures are on each horizontal line in the image file. [...]
animation_speed optional | :: float | Modifier of the animation playing speed, the default of `1` means one animation frame per tick (60 fps). [...]
Modifier of the animation playing speed, the default of `1` means one animation frame per tick (60 fps). [...]
max_advance optional | :: float | Maximum amount of frames the animation can move forward in one update. [...]
Maximum amount of frames the animation can move forward in one update. [...]
repeat_count optional | :: uint8 | How many times to repeat the animation to complete an animation cycle. [...]
How many times to repeat the animation to complete an animation cycle. [...]
dice optional | :: uint8 | Number of slices this is sliced into when using the "optimized atlas packing" option. [...]
Number of slices this is sliced into when using the "optimized atlas packing" option. [...]
dice_x optional | :: uint8 | Same as `dice` above, but this specifies only how many slices there are on the x axis.
Same as `dice` above, but this specifies only how many slices there are on the x axis.
dice_y optional | :: uint8 | Same as `dice` above, but this specifies only how many slices there are on the y axis.
Same as `dice` above, but this specifies only how many slices there are on the y axis.
frame_sequence optional | :: AnimationFrameSequence |

Inherited from SpriteParameters

priority optional | :: SpritePriority |
flags optional | :: SpriteFlags |
shift optional | :: Vector | The shift in tiles. [...]
The shift in tiles. [...]
rotate_shift optional | :: boolean | Whether to rotate the `shift` alongside the sprite's rotation. [...]
Whether to rotate the `shift` alongside the sprite's rotation. [...]
apply_special_effect optional | :: boolean |
scale optional | :: double | Values other than `1` specify the scale of the sprite on default zoom. [...]
Values other than `1` specify the scale of the sprite on default zoom. [...]
draw_as_shadow optional | :: boolean | Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true. [...]
Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true. [...]
draw_as_glow optional | :: boolean | Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true. [...]
Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true. [...]
draw_as_light optional | :: boolean | Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true.
Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true.
occludes_light optional | :: boolean | Loaded only if `draw_as_shadow`, `draw_as_glow` and `draw_as_light` are `false`, and only by sprites used by tile renderer (decals and underwater patches). [...]
Loaded only if `draw_as_shadow`, `draw_as_glow` and `draw_as_light` are `false`, and only by sprites used by tile renderer (decals and underwater patches). [...]
mipmap_count optional | :: uint8 | Only loaded if this is an icon, that is it has the flag `"group=icon"` or `"group=gui"`. [...]
Only loaded if this is an icon, that is it has the flag `"group=icon"` or `"group=gui"`. [...]
apply_runtime_tint optional | :: boolean |
tint_as_overlay optional | :: boolean |
invert_colors optional | :: boolean |
tint optional | :: Color |
blend_mode optional | :: BlendMode |
generate_sdf optional | :: boolean | This property is only used by sprites used in UtilitySprites that have the `"icon"` flag set. [...]
This property is only used by sprites used in UtilitySprites that have the `"icon"` flag set. [...]
surface optional | :: SpriteUsageSurfaceHint | Provides hint to sprite atlas system, so it can try to put sprites that are intended to be used at the same locations to the same sprite atlas.
Provides hint to sprite atlas system, so it can try to put sprites that are intended to be used at the same locations to the same sprite atlas.
usage optional | :: SpriteUsageHint | Provides hint to sprite atlas system, so it can pack sprites that are related to each other to the same sprite atlas.
Provides hint to sprite atlas system, so it can pack sprites that are related to each other to the same sprite atlas.

Inherited from SpriteSource

filename[overridden] optional | :: FileName | Only loaded if `layers` is not defined. [...]
Only loaded if `layers` is not defined. [...]
size optional | :: SpriteSizeType or {SpriteSizeType, SpriteSizeType} | The width and height of the sprite. [...]
The width and height of the sprite. [...]
width optional | :: SpriteSizeType | Mandatory if `size` is not defined. [...]
Mandatory if `size` is not defined. [...]
height optional | :: SpriteSizeType | Mandatory if `size` is not defined. [...]
Mandatory if `size` is not defined. [...]
x optional | :: SpriteSizeType | Horizontal position of the sprite in the source file in pixels.
Horizontal position of the sprite in the source file in pixels.
y optional | :: SpriteSizeType | Vertical position of the sprite in the source file in pixels.
Vertical position of the sprite in the source file in pixels.
position optional | :: {SpriteSizeType, SpriteSizeType} | Loaded only when `x` and `y` are both `0`. [...]
Loaded only when `x` and `y` are both `0`. [...]
load_in_minimal_mode optional | :: boolean | Minimal mode is entered when mod loading fails. [...]
Minimal mode is entered when mod loading fails. [...]
premul_alpha optional | :: boolean | Whether alpha should be pre-multiplied.
Whether alpha should be pre-multiplied.
allow_forced_downscale optional | :: boolean | If `true`, the sprite may be downsampled to half its size on load even when 'Sprite quality' graphics setting is set to 'High'. [...]
If `true`, the sprite may be downsampled to half its size on load even when 'Sprite quality' graphics setting is set to 'High'. [...]

filenames optional | :: array[FileName] | Only loaded if neither `layers` nor `stripes` are defined.
Only loaded if neither `layers` nor `stripes` are defined.
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. [...]
lines_per_file optional | :: uint32 | Only loaded if `layers` is not defined. [...]
Only loaded if `layers` is not defined. [...]
slice optional | :: uint32 | Only loaded if `layers` is not defined and if `filenames` is defined.
Only loaded if `layers` is not defined and if `filenames` is defined.
stripes optional | :: array[Stripe] | Only loaded if `layers` is not defined.
Only loaded if `layers` is not defined.

Inherited from AnimationParameters

animation_speed optional | :: float | Modifier of the animation playing speed, the default of `1` means one animation frame per tick (60 fps). [...]
Modifier of the animation playing speed, the default of `1` means one animation frame per tick (60 fps). [...]
dice optional | :: uint8 | Number of slices this is sliced into when using the "optimized atlas packing" option. [...]
Number of slices this is sliced into when using the "optimized atlas packing" option. [...]
dice_x optional | :: uint8 | Same as `dice` above, but this specifies only how many slices there are on the x axis.
Same as `dice` above, but this specifies only how many slices there are on the x axis.
dice_y optional | :: uint8 | Same as `dice` above, but this specifies only how many slices there are on the y axis.
Same as `dice` above, but this specifies only how many slices there are on the y axis.
frame_count optional | :: uint32 | Can't be `0`.
Can't be `0`.
frame_sequence optional | :: AnimationFrameSequence |
line_length optional | :: uint32 | Specifies how many pictures are on each horizontal line in the image file. [...]
Specifies how many pictures are on each horizontal line in the image file. [...]
max_advance optional | :: float | Maximum amount of frames the animation can move forward in one update. [...]
Maximum amount of frames the animation can move forward in one update. [...]
repeat_count optional | :: uint8 | How many times to repeat the animation to complete an animation cycle. [...]
How many times to repeat the animation to complete an animation cycle. [...]
run_mode optional | :: AnimationRunMode |

Inherited from SpriteParameters

apply_runtime_tint optional | :: boolean |
apply_special_effect optional | :: boolean |
blend_mode optional | :: BlendMode |
draw_as_glow optional | :: boolean | Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true. [...]
Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true. [...]
draw_as_light optional | :: boolean | Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true.
Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true.
draw_as_shadow optional | :: boolean | Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true. [...]
Only one of `draw_as_shadow`, `draw_as_glow` and `draw_as_light` can be true. [...]
flags optional | :: SpriteFlags |
generate_sdf optional | :: boolean | This property is only used by sprites used in UtilitySprites that have the `"icon"` flag set. [...]
This property is only used by sprites used in UtilitySprites that have the `"icon"` flag set. [...]
invert_colors optional | :: boolean |
mipmap_count optional | :: uint8 | Only loaded if this is an icon, that is it has the flag `"group=icon"` or `"group=gui"`. [...]
Only loaded if this is an icon, that is it has the flag `"group=icon"` or `"group=gui"`. [...]
occludes_light optional | :: boolean | Loaded only if `draw_as_shadow`, `draw_as_glow` and `draw_as_light` are `false`, and only by sprites used by tile renderer (decals and underwater patches). [...]
Loaded only if `draw_as_shadow`, `draw_as_glow` and `draw_as_light` are `false`, and only by sprites used by tile renderer (decals and underwater patches). [...]
priority optional | :: SpritePriority |
rotate_shift optional | :: boolean | Whether to rotate the `shift` alongside the sprite's rotation. [...]
Whether to rotate the `shift` alongside the sprite's rotation. [...]
scale optional | :: double | Values other than `1` specify the scale of the sprite on default zoom. [...]
Values other than `1` specify the scale of the sprite on default zoom. [...]
shift optional | :: Vector | The shift in tiles. [...]
The shift in tiles. [...]
surface optional | :: SpriteUsageSurfaceHint | Provides hint to sprite atlas system, so it can try to put sprites that are intended to be used at the same locations to the same sprite atlas.
Provides hint to sprite atlas system, so it can try to put sprites that are intended to be used at the same locations to the same sprite atlas.
tint optional | :: Color |
tint_as_overlay optional | :: boolean |
usage optional | :: SpriteUsageHint | Provides hint to sprite atlas system, so it can pack sprites that are related to each other to the same sprite atlas.
Provides hint to sprite atlas system, so it can pack sprites that are related to each other to the same sprite atlas.

Inherited from SpriteSource

filename[overridden] optional | :: FileName | Only loaded if `layers` is not defined. [...]
Only loaded if `layers` is not defined. [...]
allow_forced_downscale optional | :: boolean | If `true`, the sprite may be downsampled to half its size on load even when 'Sprite quality' graphics setting is set to 'High'. [...]
If `true`, the sprite may be downsampled to half its size on load even when 'Sprite quality' graphics setting is set to 'High'. [...]
height optional | :: SpriteSizeType | Mandatory if `size` is not defined. [...]
Mandatory if `size` is not defined. [...]
load_in_minimal_mode optional | :: boolean | Minimal mode is entered when mod loading fails. [...]
Minimal mode is entered when mod loading fails. [...]
position optional | :: {SpriteSizeType, SpriteSizeType} | Loaded only when `x` and `y` are both `0`. [...]
Loaded only when `x` and `y` are both `0`. [...]
premul_alpha optional | :: boolean | Whether alpha should be pre-multiplied.
Whether alpha should be pre-multiplied.
size optional | :: SpriteSizeType or {SpriteSizeType, SpriteSizeType} | The width and height of the sprite. [...]
The width and height of the sprite. [...]
width optional | :: SpriteSizeType | Mandatory if `size` is not defined. [...]
Mandatory if `size` is not defined. [...]
x optional | :: SpriteSizeType | Horizontal position of the sprite in the source file in pixels.
Horizontal position of the sprite in the source file in pixels.
y optional | :: SpriteSizeType | Vertical position of the sprite in the source file in pixels.
Vertical position of the sprite in the source file in pixels.

## Properties

### 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, including those inherited from AnimationParameters, are ignored.

### stripes :: array[Stripe] optional

Only loaded if `layers` is not defined.

### filenames :: array[FileName] optional

Only loaded if neither `layers` nor `stripes` are defined.

### slice :: uint32 optional

Default: Value of `frame_count`

Only loaded if `layers` is not defined and if `filenames` is defined.

### lines_per_file :: uint32 optional

Only loaded if `layers` is not defined. Mandatory if `filenames` is defined.

## Overridden Properties

### filename :: FileName optional

Only loaded if `layers` is not defined. Mandatory if neither `stripes` nor `filenames` are defined.

The path to the sprite file to use.

## Examples

    -- simple animation
    horizontal_animation =
    {
      filename = "__base__/graphics/entity/steam-engine/steam-engine-H.png",
      width = 352,
      height = 257,
      frame_count = 32,
      line_length = 8,
      shift = {0.03125, -0.1484375}
    }

    -- animation with layers
    horizontal_animation =
    {
      layers =
      {
        {
          filename = "__base__/graphics/entity/steam-engine/steam-engine-H.png",
          width = 352,
          height = 257,
          frame_count = 32,
          line_length = 8,
          shift = {0.03125, -0.15625}
        },
        {
          filename = "__base__/graphics/entity/steam-engine/steam-engine-H-shadow.png",
          width = 508,
          height = 160,
          frame_count = 32,
          line_length = 8,
          draw_as_shadow = true,
          shift = {1.5, 0.75}
        }
      }
    }

Type used in

- Animation::layers
- Animation4Way::north
- Animation4Way::north_east
- Animation4Way::east
- Animation4Way::south_east
- Animation4Way::south
- Animation4Way::south_west
- Animation4Way::west
- Animation4Way::north_west
- Animation4Way
- AnimationElement::animation
- AnimationPrototype::layers
- AnimationVariations
- BeaconPrototype::animation
- BeaconPrototype::base_picture
- BeamAnimationSet::start
- BeamAnimationSet::ending
- BeamAnimationSet::head
- BeamAnimationSet::tail
- BoilerPictures::structure
- BoilerPictures::fire
- BoilerPictures::fire_glow
- CaptureRobotPrototype::capture_animation
- CargoBayConnectableGraphicsSet::animation
- CargoHatchDefinition::hatch_graphics
- CargoLandingPadPrototype::robot_animation
- CharacterCorpsePrototype::picture
- ChargableGraphics::charge_animation
- ChargableGraphics::discharge_animation
- ConstructionRobotPrototype::smoke
- ElectricEnergyInterfacePrototype::animation
- EntityBuildAnimationPiece::top
- EntityBuildAnimationPiece::body
- FluidStreamPrototype::spine_animation
- FluidStreamPrototype::particle
- FluidStreamPrototype::shadow
- FluidTurretPrototype::muzzle_animation
- FusionGeneratorDirectionGraphicsSet::animation
- FusionGeneratorDirectionGraphicsSet::working_light
- FusionReactorConnectionGraphics::pictures
- FusionReactorConnectionGraphics::working_light_pictures
- GatePrototype::vertical_animation
- GatePrototype::horizontal_animation
- GatePrototype::vertical_rail_animation_left
- GatePrototype::vertical_rail_animation_right
- GatePrototype::horizontal_rail_animation_left
- GatePrototype::horizontal_rail_animation_right
- GatePrototype::vertical_rail_base
- GatePrototype::horizontal_rail_base
- GatePrototype::wall_patch
- GeneratorPrototype::horizontal_animation
- GeneratorPrototype::vertical_animation
- GigaCargoHatchDefinition::hatch_graphics_back
- GigaCargoHatchDefinition::hatch_graphics_front
- LabPrototype::on_animation
- LabPrototype::off_animation
- LightningGraphicsSet::cloud_background
- LightningGraphicsSet::attractor_hit_animation
- LightningGraphicsSet::ground_streamers
- LogisticContainerPrototype::animation
- PipePictures::gas_flow
- PowerSwitchPrototype::power_on_animation
- PowerSwitchPrototype::overlay_start
- PowerSwitchPrototype::overlay_loop
- ProcessionGraphic::animation
- ProcessionGraphicCatalogueItem::animation
- PumpConnectorGraphicsAnimation::standup_base
- PumpConnectorGraphicsAnimation::standup_top
- PumpConnectorGraphicsAnimation::standup_shadow
- PumpConnectorGraphicsAnimation::connector
- PumpConnectorGraphicsAnimation::connector_shadow
- RailSignalStaticSpriteLayer::sprites
- ReactorPrototype::working_light_picture
- RoboportEquipmentPrototype::recharging_animation
- RoboportPrototype::base_animation
- RoboportPrototype::door_animation_up
- RoboportPrototype::door_animation_down
- RoboportPrototype::recharging_animation
- RocketSiloPrototype::arm_02_right_animation
- RocketSiloPrototype::arm_01_back_animation
- RocketSiloPrototype::arm_03_front_animation
- RocketSiloPrototype::satellite_animation
- RocketSiloPrototype::satellite_shadow_animation
- RocketSiloRocketPrototype::rocket_smoke_bottom1_animation
- RocketSiloRocketPrototype::rocket_smoke_bottom2_animation
- RocketSiloRocketPrototype::rocket_smoke_top1_animation
- RocketSiloRocketPrototype::rocket_smoke_top2_animation
- RocketSiloRocketPrototype::rocket_smoke_top3_animation
- RocketSiloRocketPrototype::rocket_flame_animation
- RocketSiloRocketPrototype::rocket_flame_left_animation
- RocketSiloRocketPrototype::rocket_flame_right_animation
- RollingStockPrototype::horizontal_doors
- RollingStockPrototype::vertical_doors
- SmokePrototype::animation
- SmokePrototype::glow_animation
- SpiderVehicleGraphicsSet::autopilot_destination_on_map_visualisation
- SpiderVehicleGraphicsSet::autopilot_destination_queue_on_map_visualisation
- SpiderVehicleGraphicsSet::autopilot_destination_visualisation
- SpiderVehicleGraphicsSet::autopilot_destination_queue_visualisation
- StickerPrototype::animation
- StorageTankPictures::gas_flow
- TransportBeltConnectorFrame::frame_main_scanner
- TransportBeltConnectorFrame::frame_main_scanner_nw_ne
- TransportBeltConnectorFrame::frame_main_scanner_sw_se
- TreeVariation::trunk
- TreeVariation::leaves
- TreeVariation::shadow
- TreeVariation::normal
- TreeVariation::overlay
- TreeVariation::underwater
- TrivialSmokePrototype::animation
- TrivialSmokePrototype::glow_animation
- UtilitySprites::clouds
- UtilitySprites::arrow_button
- UtilitySprites::explosion_chart_visualization
- UtilitySprites::refresh_white
- UtilitySprites::navmesh_pending_icon
- WorkingVisualisation::north_animation
- WorkingVisualisation::east_animation
- WorkingVisualisation::south_animation
- WorkingVisualisation::west_animation
- WorkingVisualisation::animation