Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

  • Qt 4.8
  • SpringAnimation QML Element

SpringAnimation QML Element

TheSpringAnimation element allows a property to track a value in a spring-like motion.More...

Since: Qt 4.7
Inherits:

NumberAnimation

Properties

Detailed Description

SpringAnimation mimics the oscillatory behavior of a spring, with the appropriatespring constant to control the acceleration and thedamping to control how quickly the effect dies away.

You can also limit the maximumvelocity of the animation.

The followingRectangle moves to the position of the mouse using aSpringAnimation when the mouse is clicked. The use of theBehavior on thex andy values indicates that whenever these values are changed, aSpringAnimation should be applied.

import QtQuick 1.0Item {width:300;height:300Rectangle {id:rectwidth:50;height:50color:"red"        Behavior onx {SpringAnimation {spring:2;damping:0.2 } }        Behavior ony {SpringAnimation {spring:2;damping:0.2 } }    }MouseArea {anchors.fill:parentonClicked: {rect.x=mouse.x-rect.width/2rect.y=mouse.y-rect.height/2        }    }}

Like any other animation element, aSpringAnimation can be applied in a number of ways, including transitions, behaviors and property value sources. TheQML Animation and Transitions documentation shows a variety of methods for creating animations.

See alsoSmoothedAnimation,QML Animation and Transitions, Animation basics example, andClocks example.

Property Documentation

damping :real

This property holds the spring damping value.

This value describes how quickly the spring-like motion comes to rest. The default value is 0.

The useful value range is 0 - 1.0. The lower the value, the faster it comes to rest.


epsilon :real

This property holds the spring epsilon.

The epsilon is the rate and amount of change in the value which is close enough to 0 to be considered equal to zero. This will depend on the usage of the value. For pixel positions, 0.25 would suffice. For scale, 0.005 will suffice.

The default is 0.01. Tuning this value can provide small performance improvements.


mass :real

This property holds the "mass" of the property being moved.

The value is 1.0 by default.

A greater mass causes slower movement and a greater spring-like motion when an item comes to rest.


modulus :real

This property holds the modulus value. The default value is 0.

Setting amodulus forces the target value to "wrap around" at the modulus. For example, setting the modulus to 360 will cause a value of 370 to wrap around to 10.


spring :real

This property describes how strongly the target is pulled towards the source. The default value is 0 (that is, the spring-like motion is disabled).

The useful value range is 0 - 5.0.

When this property is set and thevelocity value is greater than 0, thevelocity limits the maximum speed.


velocity :real

This property holds the maximum velocity allowed when tracking the source.

The default value is 0 (no maximum velocity).


© 2016 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 theGNU 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.


[8]ページ先頭

©2009-2025 Movatter.jp