Custom Animations#

Custom Animations allows all textures to be animated, like GUIs and entities.

_images/icon6.png

Animation is in a “sheet”#

In Minecraft 1.5, Mojang added the ability to animate any block or item texture (originally a feature provided by MCPatcher). However, there is yet no way to animate other textures like mob skins or GUIs. OptiFine fills the gap enabling any rectangular area of any non-block or item texture to be animated.

This includes even textures specific to other OptiFine features such as random mob skins or skyboxes.

For 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, non-overlapping parts of the same texture can be animated by using the same to value with different from, x, y, w, and h values. They can even have independent timing and frame order information.

For maximum compatibility, it is best to make x, y, w, and h multiples of 16 (16, 32, 64, 128, etc.).

Properties#

Location

/assets/minecraft/optifine/anim/ANY NAME.properties

Note

duration, interpolate, skip, tile, duration are optional, rest are required

Key

Values

Meaning

from

Values: String, path to texture
Required: ✅ Yes

Path to animation to display

to

Values: String, path to texture
Required: ✅ Yes

Path to static texture to replace

x

Values: Positive integer
Required: ✅ Yes

X coordinate of area to animate

y

Values: Positive integer
Required: ✅ Yes

Y coordinate of area to animate

w

Values: Positive integer
Required: ✅ Yes

Width of individual animation frame

h

Values: Positive integer
Required: ✅ Yes

Height of individual animation frame

duration

Values: Positive integer
Required: ❌ No

Duration of each frame, in ticks

interpolate

Values: Boolean
Required: ❌ No

Interpolate between each frame

skip

Values: Positive integer
Required: ❌ No

Frame number to skip during animation

tile.<N>

Values: Positive integer, N is positive integer
Required: ❌ No

Tile to display at N-th tick

duration.<N>

Values: Positive integer, N is positive integer
Required: ❌ No

Duration in ticks to display tile N for

Example#

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 Properties Files 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 also 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 frames should be displayed in. Y is the tile number in the animation PNG file, 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 16x48 (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.


🆚️ This documentation assumes the latest OptiFine version. Notes are not made for legacy versions (1.8).
🔙️ This documentation is updated to commit 8410499f.
©️ This file is offered without any copyright restrictions. Please copy and modify it to suit your needs. Credit is optional, but appreciated.