Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Animate an anchored object.
Forum Updated to NodeBB v4.3 + New Features

Animate an anchored object.

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alicemirror
    wrote on 9 Mar 2011, 23:52 last edited by
    #1

    Hi,

    I have a problem: I created an Item that has an image (on a separate qml file) then in the main.qml program I anchored this object to the screen. My needs as to center, so I anchored the object with

    @anchors.vericalCenter = screen.verticalCenter
    anchors.horizontalCenter = screen.horizontalCenter@

    This works correctly, but I need to apply a behavioral animation on a boolean flag that sounds like

    @Behavior on boolean_flag { ... }@

    The animation I need is a movement along the y axis. What I see is that is this axis is anchored, obviously it cant' be moved changing the value of its 'y' property. What property I will use to move the object ?

    Enrico Miglino (aka Alicemirror)
    Balearic Dynamics
    Islas Baleares, Ibiza (Spain)
    www.balearicdynamics.com

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on 10 Mar 2011, 00:36 last edited by
      #2

      Hi,

      You can use the "AnchorAnimation":http://doc.qt.nokia.com/4.7/qml-anchoranimation.html element to animate changes to the anchors.

      Alternatively, you could try to animate the anchors.verticalCenterOffset property with a NumberAnimation, which will also effectively change the y value.

      Regards,
      Michael

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Alicemirror
        wrote on 10 Mar 2011, 06:59 last edited by
        #3

        Thank you very much, mbrasser.

        My question seems silly, but I was trying to disentangle myself in the various animations options to decide the best strategy.

        I see that there are two possibilities to do animations:

        • Create the Item, i.e. an image, and a property (the animation) Then act on this custom property with a trigger, a behavior etc.
        • Create the Item, i.e. an image, (and if needed other optional elements) Then create a NumberAnimation.

        Actually I am working with the second strategy: what is the preferred strategy between these two different approaches? I find troubles to manage animation properties, but it seems to me that if the animation should even occur defining this as an object property is the best way (I used this for multi-state buttons)

        Thank you

        Enrico Miglino (aka Alicemirror)
        Balearic Dynamics
        Islas Baleares, Ibiza (Spain)
        www.balearicdynamics.com

        1 Reply Last reply
        0

        1/3

        9 Mar 2011, 23:52

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved