绘画#
介绍#
这款VR机器人使用一支笔在游乐场上边移动边作画。机器人的笔可以改变粗细、颜色,并能覆盖整个游乐场。
以下是所有可用模块的列表:
操作——改变画笔状态以及游乐场和其他图画的填充颜色。
move– Raise or lower the robot’s pen.fill– Fill a playground or an enclosed area with a specified color.
修改器 – 修改画笔的颜色和粗细。
set_pen_color– Set the color of the robot’s pen from preset options.set_pen_width– Set the width of the robot’s pen.set_pen_color_rgb– Set the color of the robot’s pen with red, green, and blue values.
行动#
move#
move sets the position of the VR Pen.
Usage:
pen.move(action)
参数 |
描述 |
|---|---|
|
The set position of the VR Pen:
|
def main():
# Draw a straight line.
pen.move(DOWN)
drivetrain.drive_for(FORWARD, 400, MM)
# VR threads — Do not delete
vr_thread(main)
fill#
fill fills in the shape of whatever the VR Pen is on top of, for example:
网格线 |
网格方块 |
在没有网格的操场上,它会铺满整个操场地面。 |
Usage:
pen.fill(red, green, blue, opacity)
参数 |
描述 |
|---|---|
|
RGB 值中红色颜色的强度,范围从 0 到 255。 |
|
RGB 值中绿色的强度,范围从 0 到 255。 |
|
RGB 值中蓝色的强度,范围从 0 到 255。 |
|
VR笔颜色的透明度,范围从0%到100%。 |
def main():
# Fill the playground's floor with blue at full opacity.
pen.fill(43, 162, 202, 100)
# VR threads — Do not delete
vr_thread(main)
变异体#
set_pen_color#
set_pen_color sets the color of the VR Pen from preset options.
Usage:
pen.set_pen_color(color)
参数 |
描述 |
|---|---|
|
The color of the VR Pen: |
def main():
# Draw a blue line
pen.move(DOWN)
pen.set_pen_color(BLUE)
drivetrain.drive_for(FORWARD, 400, MM)
# VR threads — Do not delete
vr_thread(main)
set_pen_width#
set_pen_width method is used to set the width of the VR Pen.
Usage:
pen.set_pen_width(width)
参数 |
描述 |
|---|---|
|
The width of the VR Pen:
|
def main():
# Draw a straight line of medium width
pen.move(DOWN)
pen.set_pen_width(MEDIUM)
drivetrain.drive_for(FORWARD, 400, MM)
# VR threads — Do not delete
vr_thread(main)
set_pen_color_rgb#
set_pen_color_rgb method is used to set the RGB and opacity values for the VR Pen’s color.
Usage:
pen.set_pen_color_rgb(red, green, blue, opacity)
参数 |
描述 |
|---|---|
|
RGB 值中红色颜色的强度,范围从 0 到 255。 |
|
RGB 值中绿色的强度,范围从 0 到 255。 |
|
RGB 值中蓝色的强度,范围从 0 到 255。 |
|
VR笔颜色的透明度,范围从0%到100%。 |
def main():
# Draw an orange line
pen.move(DOWN)
pen.set_pen_color_rgb(225, 112, 52, 100)
drivetrain.drive_for(FORWARD, 400, MM)
# VR threads — Do not delete
vr_thread(main)


