Shadow3DDecorator class

Shadow3DDecorator casts a realistic-looking shadow from the component onto the ground.

This decorator is suitable for games that use an isometric projection.

The shadows are very flexible, allowing for different positions of sun in the sky, and even supporting airborne objects.

Still, these are not real 3D shadows cast by real 3D objects on a real 3D terrain, so many limitations apply. For example, the shadow must fall on the flat ground, having the sun too high in the sky is undesirable as it would betray the fact that the component is really flat, etc.

Inheritance

Constructors

Shadow3DDecorator({Vector2? base, double? ascent, double? angle, double? xShift, double? yScale, double? blur, double? opacity})

Properties

angle double
Visual angle between a vertically standing component and the ground. This angle is determined by your isometric projection. Use negative values smaller than τ/4 (1.57) in magnitude to create shadows that are behind the objects. Use positive angles that are slightly above τ/4 to make shadows that are in front of the objects.
getter/setter pair
ascent double
How high is the component above the ground.
getter/setter pair
base Vector2
Coordinates of the point where the component "touches the ground". If the component is airborne (i.e. ascent is non-zero), then this should be the coordinate of the point where the component would have touched the ground if it landed.
getter/setter pair
blur double
The amount of blur to apply to the shadow. The value of 0 produces crisp shadows with sharp edges, whereas positive blur produces softer-looking shadows.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isLastDecorator bool
no setterinherited
opacity double
Shadow's intensity. The value of 1 will create a hard pitch-black shadow, which can only happen when there are no ambient sources of light (e.g. in a cave). Values close to 0 will make the shadow barely visible, such as on a cloudy day.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
xShift double
The amount of skew the shadow is experiencing. The value of 0 corresponds to the shadow being right behind (or in front of) the object. Positive shift skews the shadow to the right if it's behind the object, or to the left if the shadow is in front of the object. Negative shift skews in the opposite direction.
getter/setter pair
yScale double
The length of the shadow relative to the height of the object. If the sun is 45º above the horizon, this scale will be 1. When the sun is higher in the sky, the scale factor should be less than 1, and when the sun is lower, the scale factor ought to be greater than 1.
getter/setter pair

Methods

addLast(Decorator? decorator) → void
Adds a new decorator onto the chain of decorators
inherited
apply(void draw(Canvas), Canvas canvas) → void
Applies visual effect while drawing on the canvas.
override
applyChain(void draw(Canvas), Canvas canvas) → void
Applies this and all subsequent decorators if any.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeLast() → void
Removes the last decorator from the chain of decorators
inherited
replaceLast(Decorator? decorator) → void
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited