SPSCALE
Root / Documentation / [.]
Created:
Change the size of a sprite.
# Syntax
```sbsyntax
SPSCALE id, scale {, time}
```
|Input|Description|[#]
|id|Sprite id|
|scale|New sprite scale, as a percentage|
|time|Time to change to new scale, in frames|
Changes the scale of sprite `id` to the given size `scale`. This scales up the sprite based on the `SPHOME` position. If `time` is provided, the sprite's scale changes smoothly from the old scale to the new scale `scale`.
# Examples
```sb
'Create sprite (star)
SPSET 0,156,3,0,0,0
'Scale star to 50%
SPSCALE 0,50
```
```sb
'Create sprite (star)
SPSET 0,156,3,0,0,0
'Scale to 200% over 60 frames (1 second)
SPSCALE 0,200,60
```
# Notes
`id` and `time` are rounded down.
`scale` accepts decimal values, as long as they are within the normal range of [0,200]. These values will scale the sprite appropriately.
If a sprite is being scaled over time and the scaling is interrupted by another interpolated `SPSCALE`, the starting scale is the currently interpolated position.
# Errors
|Action|Error|[#]
|Fewer than two arguments are passed|Missing operand|
|More than three arguments are passed|Syntax error|
|A string argument is passed|Type Mismatch|
|A value less than zero or greater than 31 is passed for `id`|Out of range|
|`id` does not correspond to an active sprite|Illegal function call|
|A value less than zero or greater than 200 is passed for `scale`|Out of range|
|A value less than zero is passed for `time`|Out of range|
# See Also
- sbs:page/docs-ptc-sprite[Sprite overview]
- sbs:page/docs-ptc-sphome{`SPHOME`}
- sbs:page/docs-ptc-spread{`SPREAD`}
No posts yet (will you be the first?)