Scene language
Updated on August 5, 2026
SimuLab scenes are not drawn with a graphical editor: they are described by writing. This means you can define exactly which figures appear, how they move, and from which viewpoint, using a simple language designed for science problems.
Where to edit a scene
When creating or editing a problem manually, scroll down to the Statement section of the editor. Below the statement text you will find a monospace text field with the placeholder Simulation code. That is where you write the code. The Preview button runs the scene in a preview box so you can see it before saving.
General structure
A scene has two main parts:
- The
sceneblock, which defines the scene type (2dor3d), the visible area, and all the figures. - One or more
animblocks, which define how figures move or change over time, using the formatanim start..end.
Inside an anim block, each animation line can be prefixed with @start..end to specify during which time interval that particular animation occurs.
Available element families
2D scenes
| Element | Purpose |
|---|---|
point |
Marks a position with a dot and an optional label |
vector |
Arrow with direction and magnitude |
segment |
Segment between two points |
line |
Infinite line through two points |
circle |
Circle, filled or outline only |
rect |
Rectangle |
polygon |
Polygon with as many vertices as you need |
curve |
Curve defined by a mathematical function |
label |
Text positioned in the scene |
emitter |
Particle emitter (fluids, fields) |
axis |
Cartesian axes with labels |
3D scenes
| Element | Purpose |
|---|---|
sphere |
Sphere in space |
box |
Rectangular box |
cylinder |
Cylinder |
plane |
Plane |
arrow3 |
Arrow in 3D |
molecule |
Molecule from its SMILES formula |
camera |
Configures the initial camera view |
Available animations
Animations are written in anim blocks, naming the figure they apply to. The main ones are:
| Animation | What it does |
|---|---|
move |
Moves the figure to another position |
rotate |
Makes it rotate |
scale |
Changes its size |
fade |
Changes its opacity |
oscillate |
Makes it oscillate around a point |
orbit |
Makes it orbit around another element |
follow |
Moves it along a curve |
trace |
Draws the path it travels |
spin |
Continuous rotation around an axis |
pulse |
Makes the size pulse |
flow |
Generates a particle flow over the figure |
show / hide |
Shows or hides the figure |
set |
Changes a property at a specific moment |
Minimal example
The following code defines a 2D scene with a point that moves to the right:
scene 2d
space x=-5..5 y=-5..5
point A at (0, 0) color=blue label="A"
anim 0..3
move A to (4, 0)
This example creates a two-dimensional scene, sets the visible area between −5 and 5 on both axes, places a point named A at the origin in blue, and defines an animation from 0 to 3 seconds that moves it to position (4, 0).
The scene is optional when creating a problem. If you do not add any code, the problem works just fine but without the animated visualization.
Frequently asked questions
Do I need programming knowledge to write scenes? No. The language is designed to be readable: each line describes a figure or a motion in words that resemble what they do. A few minutes of practice with the examples as reference is enough.
What colors can I use?
The available color names are: red, blue, green, yellow, orange, purple, cyan, magenta, white, black, and gray.
Can I use mathematical formulas in values?
Yes. Expression fields accept operations with sin, cos, sqrt, exp, abs, ln, log, pow, and other functions. You can also use the constants pi, e, and t (the animation time).
Next step
- Interactive scenes — what the student sees when solving a problem with a scene.
- Creating problems — a full guide to creating a problem from scratch.
- Solving a problem — how the solving screen works.