Procedurally draw shapes and paths in Unity using Rive
LinearGradient
or RadialGradient
)Rive.RenderQueue
and a Rive.Renderer
:
draw
on the render queue and pass in a Path
and Paint
object.
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..Flush()
to flush the paint to native memory. See the Example below.
MonoBehaviour
to create the above: