Shadow.Opacity

Syntax

Opacity: Number;

Description

The Opacity property determines whether the shadow is transparent.

Comments

Use JSON or the setOpacity method to set the property value and the getOpacity method to get the property value.

Example

To execute the example, the HTML page must contain the TextArea component named textArea, for which shadow is set (see Shadow Constructor). Set transparency and new position for the shadow, output settings of the container shadow and text in CSS format:

// Get shadow parameters
var shadow = textArea.getStyle(PP.ControlState.Release).getShadow();
// Set shadow angle as 0
shadow.setAngle(0);
// Set shadow transparency
shadow.setOpacity(0.6);
// Set new shadow position
shadow.setX(15);
shadow.setY(15);
// Refresh text area style
textArea.refreshStyle();
// Output the string in the CSS format with container shadow settings
console.log("Container shadow settings in the CSS format: " + shadow.toCSSFormat());
// Output the string in the CSS format with text shadow settings
console.log("Text shadow settings in the CSS format: " + shadow.toCSSTextShadowFormat());

After executing the example shadow position and opacity are changed:

The browser console also displays settings of container and text shadow in the CSS format:

Container shadow settings in the CSS format: box-shadow:15px 15px 20px 1px rgba(0, 0, 255, 0.4) ;

Text shadow settings in the CSS format: text-shadow:15px 15px 20px rgba(0, 0, 255, 0.4);

See also:

Shadow