Custom Animations

File location

/assets/minecraft/optifine/anim/**/*.properties

Custom Animations allows all textures to be animated, regardless of type or purpose. This includes even textures specific to other OptiFine features such as random mob skins or skyboxes.

Although Vanilla Minecraft allows many textures to be animated, OptiFine extends and adds onto this capability by allowing portions of textures to be animated as well.

OptiFine's animation format differs from Vanilla's mcmeta format.

Important

For whole block and item textures, including CTM and CIT replacements, continue using Mojang's mcmeta method instead.

To build an animation, first choose a texture and determine the X and Y coordinates, and width and height of the area to animate. Create the animation as a vertical strip of frames. The width should be the same as the width of the area to animate. The height should be a multiple of the animation area height.

Multiple animation sources can be applied to the same destination at different positions.

Emissive animation is also possible, see Emissive Textures.

Properties

from

Type: String

Values: File path

Required

Path to source texture of the animation to display.

to

Type: String

Values: File path

Required

Path to destination texture to replace and animate.

x

Type: Integer

Values: Positive integer

Required

X-coordinate of top-left corner of the destination texture to animate to. Normally, this is 0.

y

Type: Integer

Values: Positive integer

Required

Y-coordinate of top-left corner of the destination texture to animate to. Normally, this is 0.

w

Type: Integer

Values: Positive integer

Required

Width of an individual animation frame.

h

Type: Integer

Values: Positive integer

Required

Height of an individual animation frame.

duration

Type: Integer

Values: Positive integer

Optional

Duration of each individual frame, in ticks. For reference, there are 20 ticks in 1 second.

interpolate

Type: Boolean

Default: false

Optional

Whether to interpolate between each animated frame.

This furnace has an interpolated animation; focus on the fire inside.

skip

Type: Integer

Values: Positive integer

Optional

What frame number to skip/ignore during animation.

Important

Frame numbers start at 0, not 1.

tile.N

Type: Integer

Values: Positive integer

Optional

What frame number (starting from 0) to display at the N-th tick. N can be greater than the number of frames.

duration.N

Type: Integer

Values: Positive integer

Optional

Duration in ticks to display tile N for. This only applies to tiles for which a tile.N is declared.

Example

Rainbow squid

from=./glow_squid_glow.png
to=textures/entity/squid/glow_squid.png
x=0
y=0
w=64
h=32
duration=1
interpolate=true
skip=2

Note

See the Syntax document for how to specify paths to texture files.

This creates an interpolating animation that plays each frame in order from top to bottom once for one tick (1/20th second) each and then loops infinitely.

Frame order and timing

Each custom animation may specify its animation speed and frame order. In the properties file, add a series of entries:

tile.X=Y
duration.X=Z

X starts at 0 and represents the order of animation frames based on tick. Y is the tile number in the animation frames, the first tile being 0, the second 1, etc. Z is the duration that frame should be displayed, in game ticks (1 tick = 1/20 second).

If omitted, duration is assumed to be the default frame duration, or 1 if not configured.

For example, suppose the animation file is 16px x 48px, at 3 frames. To make it run on a 5-frame cycle with a pause in the middle, the properties file might look like this:

tile.0=0
tile.1=1
tile.2=2
duration.2=5
tile.3=1
tile.4=0

The animation happens in this order:

  1. Frame 0: Display animation tile 0 for 1 tick (default duration).

  2. Frame 1: Display animation tile 1 for 1 tick (default duration).

  3. Frame 2: Display animation tile 2 for 5 ticks (duration=5).

  4. Frame 3: Display animation tile 1 for 1 tick (default duration).

  5. Frame 4: Display animation tile 0 for 1 tick (default duration).

  6. Go back to frame 0.

Total: 5 frames over 9 ticks.


Assumes the latest OptiFine & Minecraft versions.
Updated to commit 83d482c3.