Reka Grid. Scripts

Scripts allows you to edit any parameter in grid. With this feature any adjustment is possible for group or individual element. It means you can for example hide any element of grid or set angle of rotation individually.

Script excecutes for every instance of grid. You can use col and row indexes [ i , j ] for individual adjustment.

In table below listed all available variables. Note that some of them is read only.

Variable

Description

Read

Write

time
Time in seconds for a current frame
+
-
frame
Frame number
+
-
i, j
Element indexes, i for rows and j for columns
+
-
xPart, yPart
Normalized element indexes [0..1]
+
-
xCount, yCount
Columns and rows count
+
-
visible
Boolean value determines to draw element or not
+
+
x, y
Coordinates for each element
+
+
angle
Rotation angle for each element
+
+
radius
Shape rounding radius
+
+
r, g, b, a
Colors and Alpha channel
+
+
feather
Edge feather value
+
+
stroke
Boolean value determines to draw fill or stroke
+
+
strokeWidth
Stroke width in pixels
+
+
partsCount
Shape points count
+
+
anchorX, anchorY
Anchor offset for x and y directions
+
+
scaleX, scaleY
Scale for x and y directions
+
+
angleOffset
Angle offset
+
+


Functions

Functions allows you to get values from custom Sliders, Colors and Layers. Also to get Noise and Random parameters.

GetFloat(ind) — returns the Parameters Slider value with the given index ind [1..10]


GetColor(ind) — returns the Parameters Color value with the given index ind [1..10]


GetLayer(ind, xPart, yPart)— returns the Parameters Layer value with the given index ind [1..10] and x and y coords [0..1]


GetNoise(ind, xPart, yPart) — returns the Parameters noise value with the given index ind [1..10] and x and y coords [0..1]. Noise amplitude, scale, offsets and seed can be adjusted from Parameters -> Noises


GetRandom(ind, i, j) — returns the Parameters random value with the given index ind [1..10] and i and j integer values (indexes). Random range and seed can be adjusted from Parameters -> Randoms

Scripts is based on Lua language, so you can use built-in mathematical functions like a math.sin (x) in your scripts.


Sample Scripts

This sample demonstrate how to turn each element by 90 degrees CV from each other:

angle = (i + j) * 90

This sample demonstrate how to create wave using sine function with amplitude from Slider 1 and offset from Slider 2:

y = y + GetFloat(1)*math.sin(x+GetFloat(2))

This sample demonstrate how to scatter random colors to instances from colors list. Random range and seed can be adjusted from Random 1 parameters:

r,g,b = GetColor(GetRandom(1,i,j));

In this sample Stroke and Fill is randomized. Random seed can be adjusted from Random 1 parameters:

stroke = false
if ( GetRandom(1,i,j) > 50 ) then
stroke = true
end