Skip to content

Using ALAN

cstef7 edited this page Aug 28, 2025 · 3 revisions

Using ALAN for animation

ALAN (Animation Language) is a simple programming language made for Rendeer, used for creating separate animation frames. While being quite limited, it's very light, flexible, well-structured and an entire animation can be written in one single line. It is interpreted by Rendeer in real time.

The language ignores whitespace completely.

All the ALAN code is stored inside a variable called animationScript, which can be found inside the settings.py file.

Structure

An animation is made of actions, which are made of items, that can have different attributes. They are explained in the following illustrations:

Structure of ALAN

Getting started

The following line is written in Python, but the content of the string is written in ALAN and represents a small animation:

animationScript = "1f / meshPositionX + 0.1, t; yRotation + 9, t; 10f"  

Wonderfully spinnin'

The frames for this gif have been rendered using that line of code

Let's break it down:

  • Different actions are separated by slash characters (/)

  • The first action is 1f, which renders one frame with the current settings.

  • The second action is longer, but can be broken down to different parts: the items of an actions are separated by semicolons (;).

    • meshPositionX + 0.1 is the first item of the second action. It increases the variable meshPosition[0] by 0.1

    • yRotation + 18 adds 18 to the variable yRotation

    • t specifies the repetition mode (in this case, times).

    • 10f specifies how many times the action should be done (in this case, in 10 frames). If the number of frames specified, the default is 1.

  • A total of 11 frames will be rendered. One for the first action, and 10 others for every iteration of the second action.

The default animation string is "1f" because it only renders one frame without changing the settings.

Available variables

Not all the variables are supported, as this feature is currently experimental. Here is a list of available settings:

  • resolution

  • xRotation, yRotation, zRotation

  • meshPositionX, meshPositionY, meshPositionZ

Types of items

There are currently 2 types of actions items:

  • the operation item that changes a variable by a value (operation items can have some attributes, too), for example: xRotation + 10, t

  • the repetition specifier item (some examples: 5f, 3f, 100f)

Operation attributes

Operation items can have multiple attributes. These are:

  • operation - the change in value. The structure is like this:
    Operation Item Structure
    • some examples: x + 2, meshPosition[0] - 0.65, imageResolution = 2.5
  • the repetition mode - can either be t or s (for times and steps)

Repetition Modes

  • the interpolation specifier: can either be l or b. Using i = l will create a linear transition for the operation, while i = b0 or i = b1 or i = b2 will use a bezier curve for a nice, smooth transition. Notice the number after the letter b: it specifies which bezier curve you are using. Here is a list of the currently available interpolation modes:

Interpolation Modes

Operators

The operation item can have one of the following operators:

  • + - adds a value (examples: x + 3, imageResolution + 50)
  • - - substracts a value (example: meshPosition[1] - 0.2)
  • = - gradually adds or substracts until the variable is equal to a certain value (can only be used with the steps repetition mode. If times is chosen, it is automatically changed to steps.)

Repetition modes

  • Times mode: does the action a number of times. For example, if the variable xRotation had an initial value of 0, the action xRotation + 10; 4t will render four images, like this:
    • xRotation = 10
    • xRotation = 20
    • xRotation = 30
    • xRotation = 40
  • Steps mode: does the action in a number of steps. If we replace the action above with xRotation + 10; 4s, the value of the variable in the four frames will be the following:
    • xRotation = 2.5
    • xRotation = 5
    • xRotation = 7.5
    • xRotation = 10

Curves

The curves variable looks like this:

curves = [[[0, 0], [0, 0.5], [0.5, 1], [1, 1]],
          [[0, 0], [0.5, 0], [0.5, 1], [1, 1]],
          [[0, 0], [0.27, 0.17], [0.25, 1], [1, 1]],
                #you can add more curves!
          ]

Adding curves

This is the structure of an element of the curves variable:

Bezier curve

As stated in the comment, you can extend the variable by simply adding a new element. The first and last coordinates are the start and the end of the curve and should not be changed. Instead, change the coordinates of the control points in order to have a smooth transition.

Using the curves

The currently available curves are b0, b1, and b2. If you add a new curve, use it with the attribute i = b3. The number increases with every curve you add (you basically specify the index of the element in the curves array).

Clone this wiki locally