Effect

Applies shader effects such as rounded corners, borders, and gradients to Poster and Rectangle nodes

Extends Group

Available since Roku OS 16.0.

The Effect node applies predefined shader effects to existing SceneGraph nodes. The Poster and Rectangle nodes include an effect field that references an Effect node.

effect-node

On platforms without a shader-capable GPU, or when disabled by configuration, the Effect node does nothing and the node to which it is applied renders as though the Effect were not present. Check the read-only supported field to determine availability.

Fields

FieldTypeDefaultAccess PermissionDescription
supportedbooleanPlatform-dependentREAD_ONLYIndicates whether effects are supported on the device platform.
borderRadiusarray of float[]READ_WRITE0, 1, or 4 floats specifying corner radii clockwise from the top right, in pixels. Other lengths are silently truncated to length 1 or 4.
borderWidthfloat0.0READ_WRITEThe width in pixels of a border drawn around the edge.
borderPaddingfloat0.0READ_WRITEPadding between the content rect and the border stroke, in pixels.
borderColorcolor0xFFFFFFFFREAD_WRITEThe color of the border.
gradientColorsarray of color[]READ_WRITEAt least 2 and at most 8 color values interpolated along a gradient. Indexes 8 or higher are ignored.
gradientStopsarray of float[]READ_WRITEThe fractional distances along the gradient of each color. If not specified, even distribution is assumed. If specified, it should have the same length as gradientColors, and is truncated or ignored if it does not.
gradientAnglefloat0.0READ_WRITEThe angle of a linear gradient, in degrees, clockwise from "up".
gradientCentrevector2d[0.5, 0.5]READ_WRITEThe center point of a radial gradient, normalized between 0 and 1. Values outside that range work, but are outside the node.
gradientRadiusvector2d1.0READ_WRITEThe radius of a radial gradient in the x and y directions, proportional to the node size.
gradientStylestring"none"READ_WRITEGradient fill style applied over the content area: "none", "linear", or "radial".
gradientFillContentbooleantrueREAD_WRITEApplies the specified gradient to the content area.
gradientFillBorderbooleanfalseREAD_WRITEApplies the specified gradient to the border area. Both gradientFillContent and gradientFillBorder may be set to true.

Example

rounded = CreateObject("roSGNode", "Effect")
rounded.borderRadius = [50]

square = CreateObject("roSGNode", "Poster")
square.uri = "pkg:/images/square.png"
square.effect = rounded

Did this page help you?