Drawing#

Introduction#

The VR Robot uses a pen to draw on a playground as it moves. The robot’s pen can change width, color, and fill enclosed area.

Below is a list of all available blocks:

  • move pen – Raise or lower the robot’s pen.

  • set pen to width – Set the width of the robot’s pen.

  • set pen to color – Set the color of the robot’s pen from a list.

  • set pen color – Set the color of the robot’s pen with red, green, and blue values.

  • fill area – Fill a playground or an enclosed area with a specified color.

move pen#

The move pen block raises or lowers the robot’s pen, allowing it to start or stop drawing.

移动笔 [向下 v]

Parameters

Description

state

The state of the robot’s pen:

  • down
  • up

Example

当开始 :: hat events
[Draw a square.]
移动笔 [向下 v]
重复 (4)
驱动 [向前 v] [150] [毫米 v] ▶
[右 v] 转 [90] 度 ▶

set pen to width#

The set pen to width block sets how thick the drawn lines from the pen appear.

A top-down view of the VEXcode VR Art Canvas + playground, with five different black lines drawn side-by-side. Each line is a different width, increasing in size as it moves to the right.

设定笔宽为 [thin v]

Parameters

Description

width

The width of the robot’s pen:

  • extra thin
  • thin (default)
  • medium
  • wide
  • extra wide

Example

当开始 :: hat events
[Draw an extra wide square.]
设定笔宽为 [extra wide v]
移动笔 [向下 v]
重复 (4)
驱动 [向前 v] [150] [毫米 v] ▶
[右 v] 转 [90] 度 ▶

set pen to color#

The set pen to color block sets the color of the pen from a preset list.

设定笔颜色为 [black v]

Parameters

Description

color

The color of the robot’s pen:

  • black
  • red
  • green
  • blue

Example

当开始 :: hat events
[Draw a blue square.]
设定笔颜色为 [蓝色 v]
移动笔 [向下 v]
重复 (4)
驱动 [向前 v] [150] [毫米 v] ▶
[右 v] 转 [90] 度 ▶

set pen color#

The set pen color block sets the color of the pen by manually providing red, green, blue, and opacity values. Adjust the different values by using the sliders that appear when clicking the color in the set pen color block.

设定笔颜色为 (::#000000)

Parameters

Description

red

The red value of the color from 0 to 255.

green

The green value of the color from 0 to 255.

blue

The blue value of the color from 0 to 255.

opacity

How transparent the color is as a percentage from 0 to 100.

Example

当开始 :: hat events
[Draw a pink square.]
设定笔颜色为 (::#D900D9)
移动笔 [向下 v]
重复 (4)
驱动 [向前 v] [150] [毫米 v] ▶
[右 v] 转 [90] 度 ▶

fill area#

The fill area block fills a playground or enclosed area with a specified color by manually providing red, green, blue, and opacity values. Adjust the different values by using the sliders that appear when clicking the color in the fill area block.

填充区域用颜色 (::#000000)

Parameters

Description

red

The red value of the color from 0 to 255.

green

The green value of the color from 0 to 255.

blue

The blue value of the color from 0 to 255.

opacity

How transparent the color is as a percentage from 0 to 100.

Example

当开始 :: hat events
[Fill the playground with pink.]
移动笔 [向下 v]
填充区域用颜色 (::#D900D9)