Class: SpriteComponent
assetId is the canonical storage; spriteFrame is a cached SpriteFrame wrapper for the same id with getSize()/texture accessors. Setting either keeps both in sync.
Extends
Constructors
Constructor
ts
new SpriteComponent(
assetId?,
tint?,
sizeMode?
): SpriteComponent;Parameters
| Parameter | Type | Default value |
|---|---|---|
assetId | | string | SpriteFrame | "" |
tint | number | 0xFFFFFF |
sizeMode | SpriteSizeMode | SpriteSizeMode.Raw |
Returns
SpriteComponent
Overrides
Properties
| Property | Modifier | Type | Default value | Description | Inherited from |
|---|---|---|---|---|---|
assetId | public | string | undefined | - | - |
dirty | public | boolean | true | - | Component.dirty |
enabled | public | boolean | true | - | Component.enabled |
fillRange | public | number | undefined | - | - |
fillStart | public | number | undefined | - | - |
fillType | public | SpriteFillType | undefined | Fill (Cocos-style FILLED). fillType None = normal sprite; Horizontal/Vertical crop the texture to a [start, start+range] band along that axis. start/range are 0..1 fractions. | - |
material | public | string | undefined | Material slot (MaterialFields.ts). | - |
materialValues | public | Record<string, unknown> | undefined | - | - |
sizeMode | public | SpriteSizeMode | undefined | - | - |
tint | public | number | undefined | - | - |
Accessors
spriteFrame
Get Signature
ts
get spriteFrame(): SpriteFrame;Returns
Set Signature
ts
set spriteFrame(frame): void;Parameters
| Parameter | Type |
|---|---|
frame | SpriteFrame |
Returns
void