Prototype/Animation: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(repeat_count desc copied from Types/Animation)
(Removed old prototype docs)
Tag: Replaced
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Prototype parent}}
<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/prototypes/AnimationPrototype.html https://lua-api.factorio.com/latest/prototypes/AnimationPrototype.html]
Specifies a animation that can be used by https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.draw_animation during runtime.


{{Prototype TOC|animation}}
</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>
 
== Mandatory properties ==
 
{{Prototype property|type|[[Types/string|string]]}}
Must be "animation".
 
{{Prototype property|name|[[Types/string|string]]}}
Name of the animation. Must be unique. Used in https://lua-api.factorio.com/latest/LuaRendering.html#LuaRendering.draw_animation.
 
== Optional properties ==
 
{{Prototype property|layers|[[Types/table|table]] of [[Types/Animation|Animation]]|optional=true}}
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. Each item (Animation definition) in the array may also have the <code>layers</code> property.
 
If this property is present, all other properties are ignored and the mandatory properties do not have to be defined.
 
Layers may not be an empty table.
 
{{Prototype property|hr_version|[[Types/Animation|Animation]]|optional=true}}
If this property exists and high resolution sprites are turned on, its contents are used to load the Animation.
 
{{Prototype property|filename|[[Types/FileName|FileName]]|""|optional=true}}
Mandatory if <code>stripes</code> is not specified.
 
{{Prototype property|priority|[[Types/SpritePriority|SpritePriority]]|"medium"|optional=true}}
 
{{Prototype property|flags|[[Types/SpriteFlags|SpriteFlags]]|optional=true}}
 
{{Prototype property|size|[[Types/SpriteSizeType|SpriteSizeType]] or [[Types/table|table]] of [[Types/SpriteSizeType|SpriteSizeType]]|optional=true}}
The width and height of the one frame. If this is an array, the first member of the array 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.
 
{{Prototype property|width|[[Types/SpriteSizeType|SpriteSizeType]]|optional=true}}
Mandatory if <code>size</code> is not given. Width of one frame in pixels, from 0-8192.
 
{{Prototype property|height|[[Types/SpriteSizeType|SpriteSizeType]]|optional=true}}
Mandatory if <code>size</code> is not given. Height of one frame in pixels, from 0-8192.
 
{{Prototype property|x|[[Types/SpriteSizeType|SpriteSizeType]]|0|optional=true}}
Horizontal position of the animation in the source file in pixels.
 
{{Prototype property|y|[[Types/SpriteSizeType|SpriteSizeType]]|0|optional=true}}
Vertical position of the animation in the source file in pixels.
 
{{Prototype property|position|[[Types/table|table]] of [[Types/SpriteSizeType|SpriteSizeType]]|optional=true}}
Loaded only when <code>x</code> and <code>y</code> are both 0. The first member of the array is x and the second is y.
 
{{Prototype property|shift|[[Types/vector|vector]]|<nowiki>{0, 0}</nowiki>|optional=true}}
 
{{Prototype property|scale|[[Types/double|double]]|1|optional=true}}
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).
 
{{Prototype property|draw_as_shadow|[[Types/bool|bool]]|false|optional=true}}
Only one of <code>draw_as_shadow</code>, <code>draw_as_glow</code> and <code>draw_as_light</code> can be true. <code>draw_as_shadow</code> takes precedence over <code>draw_as_glow</code> and <code>draw_as_light</code>.
 
{{Prototype property|draw_as_glow |[[Types/bool|bool]]|false|optional=true}}
Only one of <code>draw_as_shadow</code>, <code>draw_as_glow</code> and <code>draw_as_light</code> can be true. <code>draw_as_glow</code> takes precedence over <code>draw_as_light</code>.
 
Draws first as a normal sprite, and again as a light layer.<sup>[https://forums.factorio.com/91682]</sup>
 
{{Prototype property|draw_as_light |[[Types/bool|bool]]|false|optional=true}}
Only one of <code>draw_as_shadow</code>, <code>draw_as_glow</code> and <code>draw_as_light</code> can be true.
 
{{Prototype property|mipmap_count|[[Types/uint8|uint8]]|0|optional=true}}
Only loaded if this is an icon (has flag "group=icon" or "group=gui").<br>
Note: mipmap_count doesn't make sense in animation, as it is not possible to layout mipmaps in a way, that would load correctly both the animation and the mipmaps (besides animations with just one frame).[https://forums.factorio.com/viewtopic.php?p=549058#p549058]
 
{{Prototype property|apply_runtime_tint|[[Types/bool|bool]]|false|optional=true}}
 
{{Prototype property|tint|[[Types/Color|Color]]|<nowiki>{r=1, g=1, b=1, a=1} (white)</nowiki>|optional=true}}
 
{{Prototype property|blend_mode|[[Types/BlendMode|BlendMode]]|"normal"|optional=true}}
 
{{Prototype property|load_in_minimal_mode|[[Types/bool|bool]]|false|optional=true}}
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 ([https://cdn.discordapp.com/attachments/340530709712076801/532315796626472972/unknown.png Example]). If you are a modder, you can just ignore this property.
 
{{Prototype property|premul_alpha|[[Types/bool|bool]]|true|optional=true}}
Whether alpha should be premultiplied.
 
{{Prototype property|generate_sdf|[[Types/bool|bool]]|false|optional=true}}
Unused.
 
{{Prototype property|run_mode|[[Types/string|string]]|"forward"|optional=true}}
Possible values are:
*forward
*backward
*forward-then-backward
 
{{Prototype property|frame_count|[[Types/uint32|uint32]]|1|optional=true}}
Can't be 0.
 
{{Prototype property|line_length|[[Types/uint32|uint32]]|0|optional=true}}
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.
 
{{Prototype property|animation_speed|[[Types/float|float]]|1|optional=true}}
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). Has to be greater than 0.
 
{{Prototype property|max_advance|[[Types/float|float]]|MAX_FLOAT|optional=true}}
 
{{Prototype property|repeat_count|[[Types/uint8|uint8]]|1|optional=true}}
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.
 
Can't be 0.
 
{{Prototype property|dice|[[Types/uint8|uint8]]|optional=true}}
 
{{Prototype property|dice_x|[[Types/uint8|uint8]]|optional=true}}
 
{{Prototype property|dice_y|[[Types/uint8|uint8]]|optional=true}}
 
{{Prototype property|frame_sequence|[[Types/AnimationFrameSequence|AnimationFrameSequence]]|optional=true}}
 
{{Prototype property|stripes|[[Types/table|table]] of [[Types/Stripe|Stripe]]|optional=true}}

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/prototypes/AnimationPrototype.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.