Skip to main content

Alpha

Adjust a node's alpha to change its opacity.

A node's alpha property determines how opaque it is. The value of alpha is a number between 0 and 1. A value of 0 means the node is completely transparent and invisible. A value of 1 means the node is completely opaque and visible. A value of .5 means the node is half transparent and half opaque. The default value is 1.

note

A node's effective alpha is calculated with multiplicative inheritance from all ancestors (the node's parent, and all parents of parents). For example, if you set alpha: .5 on a Shape, and then add it as a child to a Scene with alpha: .4, the Shape will be drawn with an alpha of .2 (.5 * .4 = .2). The Shape inherits the alpha of its parent Scene, and then applies its own alpha to that value.

Below, the example has red letters A and B, both with alpha: .5. It has a red letter C, and because we did not specify the alpha, it has the default of 1. The scene also has a blue circle.

Because the A is semi-transparent, the lower half of the letter is darker where it overlaps and blends with the blue circle. The B is also semi-transparent, but it blends only with the light gray scene background. Finally, the C is opaque, so it appears a solid bright red.

Loading...
Explore:
  • See how nodes inherit their parents' alpha. The letter A has been added as a child of the circle. The circle has alpha .2, which means the letter A will be drawn with alpha .2 * .5 = .1