-
Notifications
You must be signed in to change notification settings - Fork 10
Using ALAN
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.
An animation is made of actions, which are made of items, that can have different attributes. They are explained in the following illustrations:

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"

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.1is the first item of the second action. It increases the variablemeshPosition[0]by 0.1 -
yRotation + 18adds 18 to the variableyRotation -
tspecifies the repetition mode (in this case,times). -
10fspecifies 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.
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
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 items can have multiple attributes. These are:
- operation - the change in value. The structure is like this:
- some examples:
x + 2,meshPosition[0] - 0.65,imageResolution = 2.5
- some examples:
- the repetition mode - can either be
tors(fortimesandsteps)

- the interpolation specifier: can either be
lorb. Usingi = lwill create a linear transition for the operation, whilei = b0ori = b1ori = b2will use a bezier curve for a nice, smooth transition. Notice the number after the letterb: it specifies which bezier curve you are using. Here is a list of the currently available interpolation modes:

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 thestepsrepetition mode. Iftimesis chosen, it is automatically changed tosteps.)
-
Timesmode: does the action a number of times. For example, if the variablexRotationhad an initial value of 0, the actionxRotation + 10; 4twill render four images, like this:- xRotation = 10
- xRotation = 20
- xRotation = 30
- xRotation = 40
-
Stepsmode: does the action in a number of steps. If we replace the action above withxRotation + 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
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!
]This is the structure of an element of the curves variable:

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