opacity(o?: number): OpacityComp

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

paramo- 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

returnsThe opacity comp.

sincev2000.0

kaplay logo

Misc

Layer