In the script help in Opus do a search for SetBackground()
Syntax:
SetBackground( ObjectName )
Parameters:
ObjectName – the name of an object that can contain any of the following properties:
Style – one of the Background styles you can create with this function. Style must be one of the following keywords: solid, linear, centre, circular, radial, spiral, spiral2, exponentialspiral or concentric. This property is optional. The keyword must be surrounded by quote marks or a variable containing one of the valid keywords.
Colour – the colour of the background. For a solid background style this is a single valid RGB value or a variable containing a valid RGB value. For any other gradient style (e.g. spiral) this is an array of RGB colour values – see example.
Note:
The RGB value can be calculated using the RGB function.
transparency – a percentage, showing the level of transparency for the background. transparency must be an integer between 0 and 100. This property is optional.
For non-solid styles, you can also set the following properties:
angle – the angle in degrees for linear, radial, spiral, spiral2 and exponentialspiral styles. angle must be a number between 0 and 359. This property is optional.
Note:
This property does not apply to centre, circular or concentric styles.
twist – the amount of twist to apply to spiral, spiral2 and exponentialspiral gradient styles. twist must be a number between 0 and 2. This property is optional.
bands – the number of bands for spiral, spiral2, exponentialspiral and concentric gradient styles. bands must be a number between 0 and 20. This property is optional.
offsetx – percentage from left to put centre of gradient for centre, circular, radial, spiral, spiral2, exponentialspiral and concentric gradient styles. offsetx must be a number between 0 and 100. This property is optional.
offsety – percentage from top to put centre of gradient for centre, circular, radial, spiral, spiral2, exponentialspiral and concentric gradient styles. offsety must be a number between 0 and 100. This property is optional.
startsize – the start size of the bands in spiral, spiral2, exponentialspiral and concentric gradient styles. startsize must be a number between 1 and 100. This property is optional.
Note:
All properties are optional and if they are not set, the SetBackground function will leave the property unchanged.
Remarks:
This function allows you to create the Background style and colour for a specified object by creating a new object and setting the properties you want to change. The new object containing your changes is entered in the objectName parameter and then applied to a specified object. There are two methods of using this function:
(i) Specify an object name – in this method, the Background style will be set on the Normal (i.e. default) Object State.
(ii) Specify a new object created with the GetAppearance function – in this method, the Background style is set for the Object State of the object specified in the GetAppearance function.
Note:
The Background style can be removed using the RemoveBackground function or in the Background tab of the object’s Properties dialog.
SetBackground()
Example 1:
To set the Background style on the Normal Object State for a Text object named Intro to solid with an opacity of 50% and a colour of blue, use the following syntax:
var new_style = new Object()
new_style.style = "solid"
new_style.colour = RGB(0,0,255)
Intro.SetBackground(new_style)
Example 2:
To set the same Background style as Example 1 above on the Mouse Over Object State for a Text object named Intro, use the following syntax:
var new_style = new Object()
new_style.style = "solid"
new_style.colour = RGB(0,0,255)
createEffect = Intro.GetAppearance("Mouse Over")
createEffect.SetBackground(new_style)
Example 3:
To set the Background style for a Text object named Intro to a 3 colour spiral (leaving the bands and offset as they were), use the following syntax:
var new_style = new Object();
new_style.style = "spiral";
new_style.colour = new Array();
new_style.colour[0] = RGB(128, 0, 0);
new_style.colour[1] = RGB(0, 128, 0);
new_style.colour[2] = RGB(0, 0, 128);
new_style.twist = 0.2;
Intro.SetBackground(new_style);
Note:
In Example 3, the colours are created using an array.
Example 4:
To rotate the angle of a background by 5 degrees, use the following syntax:
var new_style = new Object();
new_style.angle = 0;
while (true)
{
Frame_2.SetBackground(new_style);
new_style.angle += 5;
wait(0.1);
}
Hope this helps
Regards
Brenden Knifton
