Type Alias: TextDropShadow
> TextDropShadow = object
Defined in: node_modules/pixi.js/lib/scene/text/TextStyle.d.ts:374
Defines a drop shadow effect for text rendering. Drop shadows add depth and emphasis to text by creating a shadow offset from the text.
Example
// Create text with basic drop shadow
const text = new Text({
text: 'Shadow Text',
style: {
fontSize: 48,
dropShadow: {
alpha: 0.5, // 50% opacity shadow
angle: Math.PI / 6, // 30 degrees
blur: 4, // Soft shadow edge
color: '#000000', // Black shadow
distance: 6 // Shadow offset
}
}
});
// Dynamic shadow updates
text.style.dropShadow = {
alpha: Math.sin(Date.now() / 1000) * 0.5 + 0.5, // Pulsing opacity
angle: Date.now() / 1000, // Rotating angle
blur: 4,
color: '#000000',
distance: 6
};
Standard
Properties
alpha
> alpha: number
Defined in: node_modules/pixi.js/lib/scene/text/TextStyle.d.ts:389
The opacity of the drop shadow.
- Range: 0 to 1
- 0 = fully transparent
- 1 = fully opaque
Example
// Set drop shadow opacity to 50%
dropShadow: {
alpha: 0.5
}
Default
1
angle
> angle: number
Defined in: node_modules/pixi.js/lib/scene/text/TextStyle.d.ts:405
The angle of the drop shadow in radians.
- 0 = right
- Math.PI/2 = down
- Math.PI = left
- Math.PI*1.5 = up
Example
// Set drop shadow angle to 30 degrees
dropShadow: {
angle: Math.PI / 6 // 30 degrees
}
Default
Math.PI/6 (30 degrees)
blur
> blur: number
Defined in: node_modules/pixi.js/lib/scene/text/TextStyle.d.ts:419
The blur radius of the shadow.
- 0 = sharp shadow
- Higher values = softer shadow
Example
// Set drop shadow blur radius to 10 pixels
dropShadow: {
blur: 10
}
Default
0
color
> color: ColorSource
Defined in: node_modules/pixi.js/lib/scene/text/TextStyle.d.ts:426
The color of the drop shadow. Accepts any valid CSS color string, hex number, or RGB/RGBA values.
Example
'#000000', 'rgba(0,0,0,0.5)', 0x000000
Default
'black'
distance
> distance: number
Defined in: node_modules/pixi.js/lib/scene/text/TextStyle.d.ts:439
The distance of the drop shadow from the text. Measured in pixels.
Example
// Set drop shadow distance to 5 pixels
dropShadow: {
distance: 5
}
Default
5