Creates a new StateMaterialSet with the specified materials for different states.
Configuration object containing materials for each state
Optionaldisable?: StateMaterialTypeMaterial for disabled state (optional, fallback to normal)
Optionaldown?: StateMaterialTypeMaterial for pressed state (optional, fallback to normal)
OptionaldownSelect?: StateMaterialTypeMaterial for pressed selected state (optional, fallback to normal)
Material for normal state (required)
OptionalnormalSelect?: StateMaterialTypeMaterial for normal selected state (optional, fallback to normal)
Optionalover?: StateMaterialTypeMaterial for hover state (optional, fallback to normal)
OptionaloverSelect?: 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 the interaction handler is enabled
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
normalmaterial is required; unspecified states automatically use the normal materialdisablestate has priority over interaction states (normal, over, down)Example
See