The with
directive
In Acid, the with
directive is a fundamental part of each program, used in the prelude of a script in order to specify the context or mode in which the program operates. This directive informs the Acid interpreter what kind of procedural generation is being used, thereby determining which builtins, shapes, environment rules, and rendering behaviors are available during execution.
Syntax
with <mode>
Where <mode>
is one of the recognized generation types.
Possible Values
-
animation
: Designed for 2D procedural animation. Supports shape drawing (circle
,square
,line
, etc.), transformations (e.g.,rotate
,x2
,->
, and propertiespos
,rot
per object), and frame-by-frame sequencing. Often used for generative art, looping visuals, and dynamic scenes. -
tile
: Enables tile-based procedural generation, typically for games or map creation. Includes support for grid-based layouts, tile adjacency rules, randomization seeds, and environmental logic for terrain generation. -
3d
(limited): Activates support for 3D procedural modeling. Though still experimental or limited in features, it allows the creation and transformation of 3D primitives like cubes, spheres, and meshes. Includes basic camera and lighting support.
Example
with animation
method draw_square_then_circle() {
square{pos{x: 100, y: 100}} -> circle
}
In this example, the with animation
line sets the context for a 2D animation. The draw_square_then_circle
method draws a square at position (100, 100)
and then transitions to drawing a circle. The ->
operator denotes a transformation or sequencing between two shapes — a behavior unique to the animation mode.