Overview
The following classes are available:- BlendMode: determines how the source pixels are blended with the destination pixels.
- Color: determines the color of the shape.
- Gradient: determines the color gradient of the shape (
LinearGradientorRadialGradient) - Paint: describes how to draw a shape - see Paint.
- PaintingStyle: determines if the shape is filled or stroked.
- Path: defines a shape’s outline or a clipping mask - see Path.
- StrokeCap: determines how the path’s endpoints are drawn.
- StrokeJoin: the kind of finish to place on the joins between segments.
RenderQueue
Create aRive.RenderQueue and a Rive.Renderer:
draw on the render queue and pass in a Path and Paint object.
Path
A path is a series of drawing commands. The path is used to define a shape’s outline or a clipping mask. Create a new path:Path class provides various methods to construct a path:
moveTo: Moves the current point to the given point.lineTo: Adds a straight line from the current point to the given point.circle: Adds a circle to the path.cubicTo: Adds a cubic bezier curve to the path.quadTo: Adds a quadratic bezier segment that curves from the current point.addPath: Adds the sub-paths of path to this path, transformed by the provided matrix.close: Closes the path. This will draw a line from the current point to the first point in the path.reset: Resets the path to an empty state.flush: to flush the path to native memory.
Paint
Paint is used to describe how to draw a shape. Create a new paint:.Flush() to flush the paint to native memory. See the Example below.
Example
This example demonstrates drawing an animated triangle to a RenderTexture.MonoBehaviour to create the above: