Draw#
The top-left corner of the V5 Brain’s screen is at coordinates (0, 0), and the bottom-right corner is at coordinates (479, 239).
The center of the V5 Brain’s screen is at coordinates (240,120).
Draw Pixel#
The Draw Pixel block is used to draw a pixel on the V5 Brain’s screen.
draw pixel (0) (0) on Brain
The Draw Pixel block requires 2 values:
Value 1: X Coordinate
Value 2: Y Coordinate
The pixel color is determined by the Set Pen Color block. The default pixel color is white.
In this example, a white pixel will be printed at (240, 120) on the V5 Brain’s screen.
when started :: hat events
draw pixel (240) (120) on Brain
Draw Line#
The Draw Line block is used to draw a line on the V5 Brain’s screen.
draw line (0) (0) (159) (107) on Brain
The Draw Line block requires 4 values:
Value 1: Beginning X coordinate
Value 2: Beginning Y coordinate
Value 3: Ending X coordinate
Value 4: Ending Y coordinate
The line color is determined by the Set Pen Color block. The default line color is white.
In this example, a white line will be drawn from the top-left corner to the bottom-right corner on the V5 Brain’s screen.
when started :: hat events
draw line (0) (0) (479) (239) on Brain
Draw Rectangle#
The Draw Rectangle block is used to draw a rectangle on the V5 Brain’s screen.
draw rectangle (0) (0) (10) (10) on Brain
The Draw Rectangle block requires 4 values:
Value 1: Beginning X coordinate
Value 2: Beginning Y coordinate
Value 3: Width of the rectangle (in pixels)
Value 4: Height of the rectangle (in pixels)
The outside line color is determined by the Set Pen Color block. The default line color is white.
The inside fill color is determined by the Set Fill Color block. The default fill color is black.
In this example, a rectangle will be drawn with its top-left corner at (50, 50) with each side being 25 pixels in length.
when started :: hat events
draw rectangle (50) (50) (25) (25) on Brain
Draw Circle#
The Draw Circle block is used to draw a circle on the V5 Brain’s screen.
draw circle (0) (0) (10) on Brain
The Draw Circle block requires 3 values:
Value 1: Center Point X
Value 2: Center Point Y
Value 3: Radius of Circle (in pixels)
The outside line color is determined by the Set Pen Color block. The default line color is white.
The inside fill color is determined by the Set Fill Color block. The default fill color is black.
In this example, a circle will be drawn with its center at (100, 70) with its radius being 20 pixels.
when started :: hat events
draw circle (100) (70) (20) on Brain
Set Pen Width#
The Set Pen Width block is used to set the width of the outline for shapes drawn on the V5 Brain’s screen.
set pen width to (10) on Brain
By default, all lines have a pen width of 1 pixel.
In this example, a rectangle will be drawn with a pen width of 1 pixel (the default) and a circle will be drawn with a pen width of 5 pixels.
when started :: hat events
draw circle (40) (70) (20) on Brain
set pen width to (5) on Brain
draw circle (100) (70) (20) on Brain
Set Pen to Color#
The Set Pen to Color block is used to set the color of lines drawn on the V5 Brain’s screen or the values printed to the Print Console.
set pen color to [red v] on [Brain v]
Select the color of the line that will be drawn.
red
green
blue
black
white
yellow
orange
purple
cyan
transparent
Choose which device to use.
In this example, a rectangle with a blue outline will be drawn.
when started :: hat events
set pen color to [blue v] on [Brain v]
draw rectangle (50) (50) (25) (25) on Brain
Set Fill Color#
The Set Fill Color block is used to set the color that fills in shapes drawn on the V5 Brain’s screen.
set fill color to [red v] on Brain
Select the color of the line that will be drawn.
red
green
blue
black
white
yellow
orange
purple
cyan
transparent
In this example, a circle filled with yellow will be drawn.
when started :: hat events
set fill color to [yellow v] on Brain
draw circle (40) (70) (20) on Brain