[Qt-qml] State transition proposal: PropertyChangesLater
Vinayakam Murugan
mvinayakam at gmail.com
Sun Feb 6 14:45:57 CET 2011
Hello Thomas
Try
NumberAnimation { target: inner; properties: 'opacity';from:0; to:1;
easing.type:Easing.InCubic; duration:1000}
You can play with the Easing type.
Warm Regards
~~~~~~~~~~~~~~~
Vinayak
http://www.flickr.com/photos/rightplacerighttime/
On Sun, Feb 6, 2011 at 5:40 AM, Thomas Perl <th.perl at gmail.com> wrote:
> Hi,
>
> I often have the case where items have two states: One state being
> "on-screen" and visible, the other state being "off-screen" and not
> visible. I'd like to animate between those states, so that the user
> "knows" that the view is going away and coming back. For performance
> reasons, the "off-screen" state should set "opacity" to 0. Now, if I
> use PropertyChanges in the state to set the opacity, the "sliding out"
> animation isn't visible, because the property changes as soon as the
> state is entered, therefore the animation isn't visible anymore. I'm
> currently working around this using a SequentialAnimation and
> ScriptAction in the transition, like this:
>
> transitions: Transition {
> SequentialAnimation {
> ScriptAction { script: inner.opacity = 1 }
> AnchorAnimation {}
> ScriptAction { script: inner.opacity = (inner.state=='onscreen') }
> }
> }
>
> (where "inner" is the object that i move, and it has two states
> "onscreen" and "offscreen")
>
> I imagine this is a common use case. How do you handle it currently? I
> could imagine something like a "PropertyChangesLater" being useful,
> behaving the same way as PropertyChanges, but carrying out the changes
> after all transitions have finished. This way, I could just say (in
> the "offscreen" state):
>
> PropertyChangesLater {
> target: inner
> opacity: 0
> }
>
> Does this make sense? Can this be considered for a future QML version,
> or is there an easier, obvious way to accomplish what I'm trying to
> do?
>
> Attached are two files: state.qml (my current workaround) and
> state-proposed.qml (example of how the same feature would be
> implemented using PropertyChangesLater).
>
> Thanks,
> Thomas
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110206/d858fee8/attachment.html
More information about the Qt-qml
mailing list