Skip to main content

Animation

Struct Animation 

Source
pub struct Animation {
Show 26 fields pub name: &'static str, pub allow_forced_downscale: Option<bool>, pub animation_speed: Option<f64>, pub apply_runtime_tint: Option<bool>, pub apply_special_effect: Option<bool>, pub blend_mode: Option<&'static str>, pub dice: Option<i64>, pub dice_x: Option<i64>, pub dice_y: Option<i64>, pub draw_as_glow: Option<bool>, pub draw_as_light: Option<bool>, pub draw_as_shadow: Option<bool>, pub filename: Option<&'static str>, pub filenames: Option<&'static [&'static str]>, pub frame_count: Option<i64>, pub generate_sdf: Option<bool>, pub invert_colors: Option<bool>, pub line_length: Option<i64>, pub lines_per_file: Option<i64>, pub load_in_minimal_mode: Option<bool>, pub max_advance: Option<f64>, pub mipmap_count: Option<i64>, pub premul_alpha: Option<bool>, pub repeat_count: Option<i64>, pub rotate_shift: Option<bool>, pub scale: Option<f64>,
}
Expand description

Minimal AnimationPrototype for data.extend.

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

type = "animation" is injected by the Lua generator.

Fields§

§name: &'static str

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

§allow_forced_downscale: Option<bool>

Only loaded if layers is not defined.

If true, the sprite may be downsampled to half its size on load even when ‘Sprite quality’ graphics setting is set to ‘High’. Whether downsampling happens depends on detected hardware and other graphics settings.

§animation_speed: Option<f64>

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.

§apply_runtime_tint: Option<bool>

Only loaded if layers is not defined.

§apply_special_effect: Option<bool>

Only loaded if layers is not defined.

§blend_mode: Option<&'static str>

Only loaded if layers is not defined.

§dice: Option<i64>

Only loaded if layers is not defined.

§dice_x: Option<i64>

Only loaded if layers is not defined.

§dice_y: Option<i64>

Only loaded if layers is not defined.

§draw_as_glow: Option<bool>

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: Option<bool>

Only loaded if layers is not defined.

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

§draw_as_shadow: Option<bool>

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.

§filename: Option<&'static str>

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

The path to the sprite file to use.

§filenames: Option<&'static [&'static str]>

Only loaded if neither layers nor stripes are defined.

§frame_count: Option<i64>

Only loaded if layers is not defined.

Can’t be 0.

§generate_sdf: Option<bool>

Only loaded if layers is not defined.

Unused.

§invert_colors: Option<bool>

Only loaded if layers is not defined.

§line_length: Option<i64>

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.

§lines_per_file: Option<i64>

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

§load_in_minimal_mode: Option<bool>

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. Modders can ignore this property.

§max_advance: Option<f64>

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.

§mipmap_count: Option<i64>

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.

§premul_alpha: Option<bool>

Only loaded if layers is not defined.

Whether alpha should be pre-multiplied.

§repeat_count: Option<i64>

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.

§rotate_shift: Option<bool>

Only loaded if layers is not defined.

§scale: Option<f64>

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).

Trait Implementations§

Source§

impl Clone for Animation

Source§

fn clone(&self) -> Animation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Animation

Source§

impl Debug for Animation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Animation

Source§

fn default() -> Animation

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Animation

Source§

fn eq(&self, other: &Animation) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Animation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.