Delayed Animations/ja

From Qt Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine.
Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean.

English Spanish Italian French 日本語 Български

遅延したアニメーション

ユーザがどこかをクリックしたときに、遅延した一連のイベントを実行したいと思ったことはありませんか。たとえば、リストを開いて再び閉じたりとか。

以下のサンプルは起動時には赤い円を表示します。ユーザがウィンドウをクリックすると矩形へと変形し、タイマーがスタートします。タイマーが発動すると、矩形は再び円へと戻ります。

import QtQuick 1.0

Rectangle {
 property int time: 800
 property int size: 300
 width: size; height: size; radius: size
 color: "red"
 Behavior on radius { NumberAnimation { duration: time } }
 Timer {
 id: reset
 interval: time;
 onTriggered: parent.radius = size
 }

MouseArea {
 anchors.fill: parent
 onClicked: {
 parent.radius = 0;
 reset.start()
 }
 }
}

注意: 直前のアニメーションの終了後に続けて別のアニメーションを実行したい場合には DOC:SequentialAnimation が利用できます。これはどちらかというと、アニメーションを任意の遅延で実行させるサンプルです。