Coding the Pen of the VR Robot

Screen_Shot_2022-04-20_at_10.50.59_AM.png

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

Screen_Shot_2022-04-20_at_11.27.28_AM.png

The Set Pen color command sets the color of the VR Pen.

Screen_Shot_2022-04-20_at_11.41.33_AM.png

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.

Screen_Shot_2022-04-20_at_11.46.57_AM.png

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.

VEXcode_Project-Screenshot.png

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

pen_width_example.png

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.

Screen_Shot_2022-04-20_at_12.15.46_PM.png

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.

Screen_Shot_2022-04-20_at_12.22.18_PM.png

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

Screen_Shot_2022-04-20_at_12.32.20_PM.png

The Fill area with color command uses the VR Pen to fill an area of the Playground with a specified color.

Screen_Shot_2022-04-20_at_12.35.49_PM.png

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.

Screen_Shot_2022-04-20_at_12.39.43_PM.png

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.

Screen_Shot_2022-04-19_at_4.32.11_PM.png

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

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: