Brushes
Instead of simple colors, you can use brushes to create more complex fills for your shapes. Brushes allow you to create gradients, patterns, textures, and other visual effects.
Solid Color Brush
Section titled “Solid Color Brush”The most basic brush is a solid color:
set {_brush} to new solid brush with color redset {_shape} to new rectangle with width 80 and height 80 and brush {_brush}Gradient Brushes
Section titled “Gradient Brushes”Gradient brushes create a smooth transition between multiple colors:
set {_brush} to new horizontal gradient brush with colors red, yellow, blueset {_shape} to new rectangle with width 80 and height 80 and brush {_brush}set {_brush} to new vertical gradient brush with colors red, yellow, blueset {_shape} to new rectangle with width 80 and height 80 and brush {_brush}set {_brush} to new radial gradient brush with colors red, yellow, blueset {_shape} to new rectangle with width 80 and height 80 and brush {_brush}Pattern Brushes
Section titled “Pattern Brushes”Pattern brushes create repeating patterns:
set {_brush} to new checkerboard pattern brush with primary color black and secondary color white and size 10set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}set {_brush} to new dots pattern brush with primary color black and secondary color white and size 8set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}set {_brush} to new stripes pattern brush with primary color black and secondary color white and size 8set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}Hatch Brushes
Section titled “Hatch Brushes”Hatch brushes create line-based patterns:
set {_brush} to new horizontal hatch brush with primary color black and secondary color white and spacing 5set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}set {_brush} to new vertical hatch brush with primary color black and secondary color white and spacing 5set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}set {_brush} to new diagonal hatch brush with primary color black and secondary color white and spacing 5set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}set {_brush} to new cross hatch brush with primary color black and secondary color white and spacing 5set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}set {_brush} to new dotted hatch brush with primary color black and secondary color white and spacing 5set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}Special Effect Brushes
Section titled “Special Effect Brushes”These brushes create more complex visual effects:
set {_brush} to new marble brush with primary color blue and secondary color white and turbulence 0.5set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}# Create a gold-like metallic effectset {_brush} to new metallic brush with color rgb(212, 175, 55) and shininess 0.7set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}set {_brush} to new noise brush with color green and intensity 0.5set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}set {_brush} to new reflective brush with color silver and light at x 20, y 20 and intensity 0.8set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}Texture Brush
Section titled “Texture Brush”You can use an existing image as a texture brush:
set {_texture} to image from file "plugins/SkImage2/textures/grass.png"set {_brush} to new texture brush from {_texture}set {_shape} to new rectangle with width 80 and height 80 and brush {_brush}