showIf
Decorator that conditionally shows or hides a property in the inspector based on another property's value.
| Type | Name | Interface Description |
|---|---|---|
| Functions | showIf(propertyName: string, condition: string | number | boolean): (target: any, key: string) => any | • Function: Decorator that conditionally shows or hides a property in the inspector based on another property's value. Useful for creating dynamic UI that adapts to user selections. Parameters • • Returns Property decorator function |
Example
@component()
export class EffectController extends APJS.BasicScriptComponent {
@serializeProperty()
public enableEffect: boolean = false;
@serializeProperty()
@showIf("enableEffect", true)
public effectIntensity: number = 0.5;
@serializeProperty()
@showIf("enableEffect", true)
public effectType: string = "linear";
}