Types/Animation: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Changed links going to the redirect Types/uint to go to Types/uint32.)
(Removed old prototype docs)
Tag: Replaced
 
(31 intermediate revisions by 6 users not shown)
Line 1: Line 1:
== Basics ==
<div class="stub"><p>'''The prototype docs have moved to a new website with an improved format.''' This documentation page can now be found here: [https://lua-api.factorio.com/latest/types/Animation.html https://lua-api.factorio.com/latest/types/Animation.html]
Specifies 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 [[Types/Sprite]] or frame of other animation, it will be shared.
</p><p>This wiki page is no longer updated and '''will be removed at some point in the future''', so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback [https://forums.factorio.com/viewforum.php?f=233 on the forums].</p></div>
 
Can be nil.
== Properties ==
=== filename ===
'''Type''':[[Types/FileName]]
=== stripes ===
'''Type''': [[Types/Stripes]]
 
Alternative picture specification to filename, it can specify more files to be used and composed as the input.
=== priority ===
'''Type''':[[Types/string]]
 
Possible values:
* extra-high
* high
* medium
* low
* very-low
 
=== width ===
'''Type''': [[Types/uint32]]
 
Width of one frame in pixels.
 
pre v0.11 '''frame_width''' was used.
=== height ===
'''Type''': [[Types/uint32]]
 
Height of one frame in pixels.
 
pre v0.11 '''frame_height''' was used.
=== frame_count ===
'''Type''': [[Types/uint32]]
=== line_length ===
'''Type''': [[Types/uint32]]
 
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 avoid pictures with too big width.
The game engine limits the width of any input picture to 2048px, so it is compatible with most graphics cards.
=== run_mode ===
'''Type''': [[Types/string]]
 
Possible values are:
*forward
*backward
*forward-then-backward
=== animation_speed ===
'''Type''': [[Types/float]]
 
Modifier of the animation playing speed, the default is 1, which 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). Can't be 0.
=== x ===
'''Type''': [[Types/uint32]]
 
'''Default''': 0
 
Horizontal position of the animation in the source file in pixels.
 
=== y ===
'''Type''': [[Types/uint32]]
 
'''Default''': 0
 
Vertical position of the animation in the source file in pixels.
 
=== shift ===
'''Type''': [[Types/vector]]
 
'''Default''': 0
=== scale ===
'''Type''': [[Types/double]]
 
'''Default''': 1
 
Values different than 1 specify the scale of the animation on default zoom.
Scale 2 means that the picture will be 2 times bigger on screen (and more pixelated).
 
== Example ==
Specification of animation of electric furnace
<syntaxhighlight lang="lua">
    on_animation =
    {
      filename = "__base__/graphics/entity/electric-furnace/electric-furnace.png",
      priority = "high",
      x = 131,
      frame_width = 131,
      frame_height = 102,
      frame_count = 12,
      animation_speed = 0.5, --0.5 frames per tick, so 2 ticks per animation frame, so 30 frames per second
      shift = {0.5, 0.05 }
    },</syntaxhighlight>

Latest revision as of 14:32, 25 October 2024

The prototype docs have moved to a new website with an improved format. This documentation page can now be found here: https://lua-api.factorio.com/latest/types/Animation.html

This wiki page is no longer updated and will be removed at some point in the future, so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback on the forums.