使用APL命令自定义动画时,可以设置其持续的时间。例如,在APL中定义以下代码,可使动画持续3秒钟:
"myAnimation": {
"type": "APL",
"version": "1.5",
"commands": {
"myCommand": {
"description": "Custom animation",
"parameters": [
{
"name": "duration",
"type": "number",
"description": "Duration of the animation in seconds"
}
],
"command": [
{
"type": "AnimateItem",
"componentId": "myComponent",
"duration": "${duration}000"
}
]
}
}
}
在调用自定义动画命令时,只需传递一些参数,如以下代码所示:
{
"type": "APL",
"version": "1.5",
"commands": [
{
"type": "myAnimation",
"duration": 3
}
]
}
这将使自定义动画持续3秒钟,不必与SSML持续时间相同。
上一篇:APL点运算符的语义是什么?