Using Properties (Studio)

Top  Previous  Next

 

 

Node properties can be connected to PixelScripts so that the behavior of scripts can be tweaked without needing to edit the script itself.

 

 

// Control variables

real frequency = 4;

real amplitude = 0.05;

 

// Ripple math

real ripple = sin(y * frequency * 2 * pi);

ripple *= amplitude;

 

// Output

result = input(1, x + ripple, y);

 

This example ripples its input image.  Paste it into the code pane of the Edit PixelScript dialog to see it in action.

 

PixelScript-8

 

// Control variables

real frequency = property(1);

real amplitude = property(2);

 

The frequency and amplitude variables control the number of ripples and their strength.  However, it would be inconvenient to need to edit the script itself every time you wished to tweak these important variables.  Instead, the property function can be used to link them to the node's properties.  The argument of the property function specifies which of the node's properties should be used.  The properties can be named from the Properties section of the Edit PixelScript dialog.

 

PixelScript-9

 

These properties can then be conveniently modified from the main nodes workspace.  The names specified above will appear here.

 

PixelScript-10

 

 

 


Page URL: http://www.spiralgraphics.biz/genetica/help/index.htm?using_properties.htm