Py5Shape.set_visible()#

Sets the shape to be visible or invisible.

Examples#

 1def setup():
 2    global s
 3    # the file "bot.svg" must be in the data folder
 4    # of the current sketch to load successfully
 5    s = py5.load_shape("bot.svg")
 6
 7
 8def draw():
 9    py5.background(204)
10    py5.shape(s, 10, 10, 80, 80)  # draw shape
11    s.set_visible(py5.is_mouse_pressed)
12    if s.is_visible() == False:  # or use: "if (!s.isVisible)"
13        py5.no_fill()
14        py5.rect(10, 10, 80, 80)

Description#

Sets the shape to be visible or invisible. This is determined by the value of the visible parameter.

The default visibility of a shape is usually controlled by whatever program created the SVG file. For instance, this parameter is controlled by showing or hiding the shape in the layers palette in Adobe Illustrator.

Underlying Processing method: PShape.setVisible

Syntax#

set_visible(visible: bool, /) -> None

Parameters#

  • visible: bool - False makes the shape invisible and True makes it visible

Updated on November 12, 2021 11:30:58am UTC