obniz
Version:
obniz sdk for javascript
116 lines (73 loc) • 2.79 kB
Markdown
# <a name="ioAnimation">ioAnimation</a>
io animation is hardware acceleration for serial sequence change of io. now 'loop' animation is available. it loop io changes regarding json array.
## request: <a name="-request-ioanimation-init">init</a>
| path | type | conditions | description |
|:---- |:---- |:---- |:---- |
| `io.animation.name` | string | <ul><li>required</li><li>1 ≤ length ≤ 254</li></ul> | Animation name to use pause/resume |
| `io.animation.repeat` | integer | <ul><li>default `undefined`</li><li>1 ≤ length ≤ 4294967295</li></ul> | The limitation number of transitions of states |
| `io.animation.status` | string | <ul><li>required</li><li>enum <ul><li>`"loop"`</li><li>`"registrate"`</li></ul></li></ul> | |
| `io.animation.states[].duration` | integer | <ul><li>required</li><li>0 ≤ value ≤ 60000</li></ul> | State duration time(ms) |
| `io.animation.states[].state` | object,array | | io/pwm commands. |
```
// Json Example
[
{
"io": {
"animation": {
"name": "animation-1",
"status": "loop",
"states": [
{
"duration": 500,
"state": {
"io0": true
}
},
{
"duration": 500,
"state": {
"io0": false
}
}
]
}
}
}
]
```
## request: <a name="-request-ioanimation-changestate">changeState</a>
| path | type | conditions | description |
|:---- |:---- |:---- |:---- |
| `io.animation.name` | string | <ul><li>required</li><li>1 ≤ length ≤ 254</li></ul> | |
| `io.animation.status` | string | <ul><li>required</li><li>enum <ul><li>`"pause"`</li><li>`"resume"`</li></ul></li></ul> | |
```
// Json Example
[
{
"io": {
"animation": {
"name": "animation-1",
"status": "pause"
}
}
}
]
```
## response: <a name="-response-ioanimation-notify">notify</a>
| path | type | conditions | description |
|:---- |:---- |:---- |:---- |
| `io.animation.name` | string | <ul><li>required</li><li>1 ≤ length ≤ 254</li></ul> | animation name which is finished |
| `io.animation.status` | string | <ul><li>required</li><li>const `"finish"`</li></ul> | status of an registrated animation |
```
//Response Example
[
{
"io": {
"animation": {
"name": "animation-1",
"status": "finish"
}
}
}
]
```