box()

A box is an extruded rectangle.

Examples

example picture for box()
1
2
3
4
5
6
def setup():
    py5.size(100, 100, py5.P3D)
    py5.translate(58, 48, 0)
    py5.rotate_y(0.5)
    py5.no_fill()
    py5.box(40)
example picture for box()
1
2
3
4
5
6
def setup():
    py5.size(100, 100, py5.P3D)
    py5.translate(58, 48, 0)
    py5.rotate_y(0.5)
    py5.no_fill()
    py5.box(40, 20, 50)

Description

A box is an extruded rectangle. A box with equal dimensions on all sides is a cube.

Underlying Java method: box

Syntax

box(size: float, /) -> None
box(w: float, h: float, d: float, /) -> None

Parameters

  • d: float - dimension of the box in the z-dimension

  • h: float - dimension of the box in the y-dimension

  • size: float - dimension of the box in all dimensions (creates a cube)

  • w: float - dimension of the box in the x-dimension

Updated on September 11, 2021 16:51:34pm UTC