ShadowNodeEffect
class ShadowNodeEffect
Extends: NodeEffect<Node>
Package: dev.joid.lib.ui.node.effect.impl · Module: core · Source: ShadowNodeEffect.java
Draws a soft shadow of the shape of a node under it, or a glow when the color is light.

Description
Section titled “Description”The shadow does not read the pixels of the node: it draws a rounded rectangle with the radius and the sides of the RoundedNodeEffect of the node, a disc for a CircleNode or a node with a CircleNodeEffect, and a plain rectangle otherwise.
It is drawn before the node and its children, which cover it.
Its priority is -50 (Control the order of effects).
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
ShadowNodeEffect | create(Color color, float blur) factory | Creates a shadow of this color and blur, in design pixels, centered under the node. |
ShadowNodeEffect | create(Supplier | Creates a shadow whose color and blur follow suppliers: signals, derived values or lambdas. |
| ShadowNodeEffect(Supplier | Called by a subclass with the same arguments as create(Supplier,Supplier). |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| blur signal | float | set at creation | Softness of the shadow, in design pixels: the distance over which it fades out around the shape. |
| color signal | Color | set at creation | Color of the shadow where it is densest; its alpha sets the strength. |
| offsetX signal | double | 0D | Horizontal shift of the shadow, in design pixels; a positive value moves it to the right. |
| offsetY signal | double | 0D | Vertical shift of the shadow, in design pixels; a positive value moves it down. |
Inherited from NodeEffect (2)
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
void | draw(Node node, Runnable body) | Draws the shadow, then the node. |
Inherited from NodeEffect (4)
Creation details
Section titled “Creation details”create
Section titled “create”ShadowNodeEffect create(Color color, float blur) factory
Creates a shadow of this color and blur, in design pixels, centered under the node.
ShadowNodeEffect create(Supplier<Color> colorSupplier, Supplier<Float> blurSupplier) factory
Creates a shadow whose color and blur follow suppliers: signals, derived values or lambdas.
ShadowNodeEffect
Section titled “ShadowNodeEffect”ShadowNodeEffect(Supplier<Color> colorSupplier, Supplier<Float> blurSupplier) protected
Called by a subclass with the same arguments as create(Supplier,Supplier).
Property details
Section titled “Property details”this blur(float blur)fluentthis blur(Supplier<Float> blurSupplier)fluent signalfloat getBlur()
Default: set at creation
Softness of the shadow, in design pixels: the distance over which it fades out around the shape.
this color(Color color)fluentthis color(Supplier<Color> colorSupplier)fluent signalColor getColor()
Default: set at creation
Color of the shadow where it is densest; its alpha sets the strength.
offsetX
Section titled “offsetX”this offsetX(double offsetX)fluentthis offsetX(Supplier<Double> offsetXSupplier)fluent signaldouble getOffsetX()
Default: 0D
Horizontal shift of the shadow, in design pixels; a positive value moves it to the right.
offsetY
Section titled “offsetY”this offsetY(double offsetY)fluentthis offsetY(Supplier<Double> offsetYSupplier)fluent signaldouble getOffsetY()
Default: 0D
Vertical shift of the shadow, in design pixels; a positive value moves it down.
Method details
Section titled “Method details”void draw(Node node, Runnable body)
Draws the shadow, then the node.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
