Sketch
Sketch is an experimental addon for Processing-style creative coding in PlayMaker.
Import the Sketch addon from the Addons Browser. If you want ready-made examples, also import Sketch Samples.
Sketch actions draw onto a Sketch Component, which creates a runtime canvas you can show with a SpriteRenderer, RawImage, or material texture.
Workflow
Most Sketch FSMs follow the same pattern:
- Add a Sketch Component to the GameObject you want to draw on.
- Use Sketch Create Canvas or Sketch Size to create the canvas.
- Set colors with Sketch Background, Sketch Fill, and Sketch Stroke.
- Draw shapes with point, line, rect, circle, ellipse, or plot actions.
- Read coordinates with the mouse/transform helper actions when you want interactive sketches.
Action Groups
Canvas
Create a sketch canvas with a specific width and height.
Processing-style alias for creating a sketch canvas.
Get the generated canvas texture for use in other actions.
Background And Style
Set and clear the canvas to a background color.
Clear the canvas using the current background color.
Fade the current image back toward the background color.
Set the fill color for shapes.
Turn off filled interiors for later shapes.
Set the stroke color for lines and outlines.
Turn off outlines, lines, and points.
Set line and outline thickness in sketch pixels.
Drawing
Draw a single point.
Draw a line between two points.
Build a connected line by feeding in points over time.
Draw a rectangle.
Draw a circle from center and diameter values.
Draw an ellipse from center, width, and height values.
Coordinate Helpers
Read mouse coordinates in sketch space.
Project a world-space Transform into sketch coordinates.
Notes
- Sketch uses direct canvas drawing, so it is great for quick visualizations, interactive experiments, and translating Processing tutorials into FSMs.
- The current version focuses on drawing directly to the canvas. Transform-style sketch commands such as translate, rotate, push, and pop are planned for future versions.
- Sample scenes currently include
GaussianDots,MouseCircles,MouseLines,PendulumPlot,PerlinNoisePlot, andRandomWalker.