There are many commands used to code the Pen of the VR Robot:
- Set Pen color
- Set Pen width
- Fill area with color
Set Pen Color
The Set Pen color command sets the color of the VR Pen.
VEXcode VR Blocks
Using the sliders, select the red, green, and blue values for the color you want to create. The numeric value will be listed next to the color (0 to 255).
Opacity describes the transparency of the color. The opacity of the pen color can be selected using the bottom slider.
The color window will update to show the final color the pen will draw on the Playground. In this example, the pen would draw a red color with a lower opacity.
The color will also appear at the top of the pen once the project is run.
VEXcode VR Python
The color of the pen is specified with: rgb values (red, green, blue).
Each parameter (red, green, and blue) defines the intensity of the color as an integer between 0 and 255.
The opacity describes the transparency of the color. Opacity is set using a value from 0 to 100 percent. This command will default to 100 percent for the opacity.
The color will also appear at the top of the pen once the project is run. In this example, the pen would draw a red color with a lower opacity.
Note that you cannot draw on the gray border on all four sides of the Art Canvas+ Playground. If you try to draw on this border, the line or patch of color will be cut off where the border is.
Set Pen Width
The Set Pen width command sets the width of the line the VR Pen will draw on the canvas.
This example was created using all five pen widths. It begins with the 'extra thin' at the left and moves in order through the 'extra wide' at the right.
VEXcode VR Blocks
Select the dropdown on the block to choose between the five Pen widths.
The default width is 'thin,' which is the blue line in this example.
VEXcode VR Python
Select one of the following five values for the VR Pen width.
- EXTRA_THIN
- THIN
- MEDIUM
- WIDE
- EXTRA_WIDE
The default width is 'thin,' which is the blue line in this example.
Fill Area With Color
The Fill area with color command uses the VR Pen to fill an area of the Playground with a specified color.
VEXcode VR Blocks
Using the sliders, select the red, green, and blue values for the fill color you want to create. The numeric value will be listed next to the color (0 to 255).
Opacity describes the transparency of the color. The opacity of the fill color can be selected using the bottom slider.
The color window will update to show the fill color on the Playground. In this example, the pen would fill the Playground with a teal color.
Note that the Pen does not have to be set to 'down' in order to use the [Fill area with color] block.
VEXcode VR Python
The color of the fill is specified with rgb values (red, green, blue) and opacity.
Each parameter (red, green, and blue) defines the intensity of the color as an integer between 0 and 255.
The opacity describes the transparency of the color. Opacity is set using a value from 0 to 100 percent. This command will default to 100 percent for the opacity.
Note that the Pen does not have to be set to 'DOWN' in order to use the fill command.
The Fill area with color command can also be used with different images on the Playground canvas to color in separate areas with different colors.
All of the examples here have been shown on the Art Canvas+ Playground. For more information on using the Playground Window in Art Canvas+, view this article.