Creates a new StateMaterialSet with the specified materials for different states.
Configuration object containing materials for each state
Optional
disable?: StateMaterialTypeMaterial for disabled state (optional, fallback to normal)
Optional
down?: StateMaterialTypeMaterial for pressed state (optional, fallback to normal)
Optional
downSelect?: StateMaterialTypeMaterial for pressed selected state (optional, fallback to normal)
Material for normal state (required)
Optional
normalSelect?: StateMaterialTypeMaterial for normal selected state (optional, fallback to normal)
Optional
over?: StateMaterialTypeMaterial for hover state (optional, fallback to normal)
Optional
overSelect?: StateMaterialTypeMaterial for hover selected state (optional, fallback to normal)
Gets the appropriate StateMaterial for the given interaction state and conditions.
The current interaction state (normal, over, down)
Whether mouse interaction is enabled for the object
Whether the object is in selected state (default: false)
The StateMaterial instance for the specified conditions
State selection priority:
const materialSet = new StateMaterialSet({
normal: normalMat,
over: hoverMat,
disable: disabledMat
});
// Get normal material
const normal = materialSet.getMaterial("normal", true, false);
// Get hover material for selected object
const hoverSelected = materialSet.getMaterial("over", true, true);
// Get disabled material (ignores state and selection)
const disabled = materialSet.getMaterial("over", false, true);
Sets the opacity for all managed materials simultaneously.
The opacity multiplier to apply (0.0 to 1.0)
A comprehensive material manager for interactive object states.
Description
StateMaterialSet manages multiple StateMaterial instances for different interactive states including normal, hover, down, disable, and their selected variants. It provides intelligent state-based material selection with priority logic and unified opacity control across all managed materials for coordinated visual feedback.
Remarks
normal
material is required; unspecified states automatically use the normal materialdisable
state has priority over interaction states (normal, over, down)Example
See