Py5Shape.is_visible()

Returns a boolean value True if the image is set to be visible, False if not.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
def setup():
    global s
    # the file "bot.svg" must be in the data folder
    # of the current sketch to load successfully
    s = py5.load_shape("bot.svg")


def draw():
    py5.background(204)
    py5.shape(s, 10, 10, 80, 80)  # draw shape
    s.set_visible(py5.is_mouse_pressed)
    if s.is_visible() == False:  # or use: "if not s.isVisible"
        py5.no_fill()
        py5.rect(10, 10, 80, 80)

Description

Returns a boolean value True if the image is set to be visible, False if not. This value can be modified with the Py5Shape.set_visible() method.

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 Java method: PShape.isVisible

Syntax

is_visible() -> bool

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