A Shadow object describes the shadow effect drawn for some content. You can obtain shadow objects using the following content object properties:
Those properties can also change the shadow of those content objects. The only exception is for text attributes, whose shadow must be changed using the Set Text Shadow command. See the example after the following shadow commands and properties.
Shadow Type Commands
Shadow.new v3.2
Returns a new black shadow, but whose offset and blur radius are zero.
Shadow.newTextShadow [color], [font], [fontSize] v3.2
Returns a new shadow that’s appropriate for use in text. The default color is black, but a Color object may be provided. The given Font object and font size are used to choose an appropriate shadow offset and blur radius. Bigger fonts should generally use bigger offsets and blur.
Shadow Object Properties
.color v3.2
The Color object for the shadow. The opacity is respected.
.horizontalOffset v3.2
The shadow’s horizontal distance from the source object (eg: image) in points. Negative values specify that the shadow is to the left of the source object; positive values specify to the right of the source.
.verticalOffset v3.2
The shadow’s vertical distance from the source object (eg: image) in points. Negative values specify that the shadow is above the source object; positive values specify below the source.
.radius v3.2
The shadow’s blur radius in points. A value of zero is a hard shadow with no blur. A larger radius means a softer shadow.
Shadow Object Examples
The following code applies a blue shadow to the selected text:
$selection = TextSelection.active
$attrs = $selection.firstDisplayAttributes
$shadow = Shadow.newTextShadow( Color.blue, $attrs.font, $attrs.fontSize )
Set Text Shadow $shadow
The following code modifies the existing shadow of the selected image, to alter its blur radius:
$image = Image.selectedImage
$shadow = $image.shadow
If ! $shadow
$shadow = Shadow.new # create a default shadow
End
$shadow.radius = 10
$image.shadow = $shadow # we must apply the modified shadow to affect the image
Previous Chapter Ref Object |
<< index >> |
Next Chapter Size Object |