• May 19, 2024, 10:06:03 pm

Author Topic: Using Property Animations on QML  (Read 851 times)

0 Members and 1 Guest are viewing this topic.

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Using Property Animations on QML
« on: June 01, 2013, 04:10:00 am »
Property Animations are kind of self explanatory, they are animations that work of the Components properties, here is a small example of one using the Scale property, this one halves the size with a fairly nice animation:

Code: [Select]
PropertyAnimation {
        target: button1
        id: button1ami
        duration: 200
        properties: "scale"
        to: 0.5
    }


To start the animation you need to use the id then .start(); like so:
Code: [Select]
button1ami.start();
You can also aim for multiple targets by using
Code: [Select]
targets: [button1,button2] instead of the usual target.

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Re: Using Property Animations on QML
« Reply #1 on: June 01, 2013, 04:20:50 am »
Also the Animation can be paused for a while by wrapping it in a  SequentialAnimation: 
Code: [Select]
SequentialAnimation {
        id: button1ami
        PauseAnimation { duration: 700 }
PropertyAnimation {
        target: button1
        duration: 200
        properties: "scale"
        to: 0.5
    }
}


Now the id is moved from the Property Animation to the Sequential so that the full thing is triggered.