Function

opacity

(o?: number): OpacityComp

Sets the opacity of a Game Object (0.0 - 1.0).

param o- The opacity value to set.

const bean = add([
    sprite("bean"),
    opacity(0.5) // Make bean 50% transparent
])

// Make bean invisible
bean.opacity = 0

// Make bean fully visible
bean.opacity = 1

returns The opacity comp.

since v2000.0

group Components

kaplay logo

Layer

Miscalenous