ScriptAction QML Type
定义在动画播放期间要运行的脚本。更多...
| Import Statement: | import QtQuick |
| Inherits: |
属性
- script : script
- scriptName : string
详细说明
ScriptAction 可用于在动画的特定时刻运行脚本。
SequentialAnimation {
NumberAnimation {
// ...
}
ScriptAction { script: doSomething(); }
NumberAnimation {
// ...
}
}当作为“过渡”的一部分使用时,您还可以通过scriptName 属性指定要运行的特定StateChangeScript 。
State {
name: "state1"
StateChangeScript {
name: "myScript"
script: doStateStuff();
}
// ...
}
// ...
Transition {
to: "state1"
SequentialAnimation {
NumberAnimation { /* ... */ }
ScriptAction { scriptName: "myScript" }
NumberAnimation { /* ... */ }
}
}另请参阅 StateChangeScript 。
属性文档
script : script
该属性包含要运行的脚本。
scriptName : string
该属性存储要运行的“StateChangeScript ”的名称。
仅当ScriptAction 作为过渡的一部分使用时,此属性才有效。如果同时设置了script和scriptName,则将使用scriptName。
注意: 在可逆过渡中使用 scriptName时, 脚本仅在过渡正向执行时才会被运行。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.