MCPcopy Create free account
hub / github.com/melonjs/melonJS / setOpacity

Method setOpacity

packages/melonjs/src/renderable/renderable.js:588–597  ·  view source on GitHub ↗

* set the renderable alpha channel value * @param {number} alpha - opacity value between 0.0 and 1.0

(alpha)

Source from the content-addressed store, hash-verified

586 * @param {number} alpha - opacity value between 0.0 and 1.0
587 */
588 setOpacity(alpha) {
589 if (typeof alpha === "number") {
590 this.alpha = clamp(alpha, 0.0, 1.0);
591 // Set to 1 if alpha is NaN
592 if (isNaN(this.alpha)) {
593 this.alpha = 1.0;
594 }
595 this.isDirty = true;
596 }
597 }
598
599 /**
600 * flip the renderable on the horizontal axis (around the center of the renderable)

Callers 15

constructorMethod · 0.95
constructorMethod · 0.45
constructorMethod · 0.45
applyObjectOpacityFunction · 0.45
readImageLayerFunction · 0.45
getObjectsMethod · 0.45
constructorMethod · 0.45
tmxtilemap.spec.jsFile · 0.45
constructorMethod · 0.45
onClickMethod · 0.45
onReleaseMethod · 0.45
constructorMethod · 0.45

Calls 1

clampFunction · 0.90

Tested by

no test coverage detected