# CountTo Number Animation
Number animation component.
## Basic Usage
Set the `endVal` property to specify the final value.
Set the `startVal` property to specify the starting value.
Set the `duration` property to specify the time for number animation from start to end.
Set the `autoplay` property to specify whether to play automatically.
Set the `decimals` property to specify the number of decimal places to retain.
Set the `decimal` property to specify the decimal point symbol.
Set the `prefix` property to specify the number prefix.
Set the `suffix` property to specify the number suffix.
Set the `fontSize` property to specify the font size.
Set the `color` property to specify the text color.
```vue
```
## Set Theme
Set the text theme through the type parameter. We provide five types: primary error success warning default.
```html
```
## Manual Control
Start the animation using the `start` method, pause it using the `pause` method, and reset it using the `reset` method.
```html
```
```ts
import type { CountToInstance } from '@/uni_modules/wot-design-uni/components/wd-count-to/types'
const countTo = ref()
const start = () => {
countTo.value!.start()
}
const pause = () => {
countTo.value!.pause()
}
const reset = () => {
countTo.value!.reset()
}
```
## Attributes
| Parameter | Description | Type | Options | Default | Version |
| ---------- | --------------------------------------------- | ------- | -------------------------------------------- | ------- | ------- |
| fontSize | Font size | number | 16 | default | 1.3.8 |
| color | Text color | string | - | '' | 1.3.8 |
| type | Theme type | string | 'primary' / 'error' / 'warning' / 'success' | default | 1.3.9 |
| startVal | Starting value | number | - | 0 | 1.3.8 |
| endVal | Final value | number | - | 2024 | 1.3.8 |
| duration | Animation duration from start to end | number | - | 3000 | 1.3.8 |
| autoplay | Auto play | boolean | - | true | 1.3.8 |
| decimals | Number of decimal places (must be >= 0) | number | - | 0 | 1.3.8 |
| decimal | Decimal point symbol | string | - | '.' | 1.3.8 |
| separator | Thousands separator | string | - | ',' | 1.3.8 |
| prefix | Prefix | string | - | - | 1.3.8 |
| suffix | Suffix | string | - | - | 1.3.8 |
| useEasing | Use easing animation | boolean | - | true | 1.3.8 |
## Events
| Event Name | Description | Parameters | Version |
| ---------- | ------------------------------------- | ---------- | ------- |
| finish | Triggered when animation completes | — | 1.3.8 |
| mounted | Triggered when component is mounted | - | 1.3.8 |
## Methods
| Method Name | Description | Parameters | Version |
| ----------- | ---------------------------------------------------------------- | ---------- | ------- |
| start | Start animation | — | 1.3.8 |
| pause | Pause animation | — | 1.3.8 |
| reset | Reset animation, auto-starts if `auto-start` is `true` | — | 1.3.8 |
## Slots
| Name | Description | Version |
| ------- | -------------- | ------- |
| default | Default slot | 1.3.8 |
| prefix | Prefix slot | 1.3.8 |
| suffix | Suffix slot | 1.3.8 |
## External Classes
| Class Name | Description | Version |
| ------------- | ---------------- | ------- |
| custom-class | Root node style | 1.3.8 |
| custom-style | Root node style | 1.3.8 |