Saturday, June 28, 2014

import QtQuick 1.0 Rectangle {color:


To enrich the first article on drag and drop and insert the movie I chose to develop an Android notification gunners bar style (ie that can be drawn down and then up).
To start draw a red rectangle with a yellow stripe to view part "pull": Rectangle {color: gunners "red" width: 800 height: 300 origineY gunners real property: gunners (-height) +40 y: origineY x 0 Rectangle { color: "yellow" width: parent.width height: 40 anchors.bottom: parent.bottom}}
MouseArea {anchors.fill: drag.target Parent: drag.axis Parent: Drag.YAxis drag.minimumY: origineY drag.maximumY: 0 onReleased: {if (parent.y <origineY +150) = parent.y origineY else parent. y = 0}}
This time component can be moved only on the Y axis, with a maximum and minimum value. Upon release of the bar, it is determined whether the bar has been drawn from more than 150 pixels, whether: the component is placed in Y = 0 so that it is fully visible, otherwise it returns to its Y component of origin, and it goes back.
Yet the transition is "brutal" and unattractive to create an animation on release and give the impression that the bar up or down, we will use the Behavior element that determines behavior gunners on a property . Here we want to interpolate different values of Y for example 200ms with a rebound gunners effect.
import QtQuick 1.0 Rectangle {color: "red" width: 800 height: 300 origineY real property: (-height) +40 y: origineY x 0 Rectangle {color: "yellow" width: parent.width height: 40 anchors.bottom : parent.bottom} {Behavior there NumberAnimation {duration: 200; easing.type "OutBounce"}} {MouseArea anchors.fill: drag.target Parent: drag.axis Parent: Drag.YAxis drag.minimumY: origineY drag.maximumY: 0 onReleased: {if (parent.y <origineY 150 ) parent.y = origineY else parent.y = 0}}}
Website
You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <b> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Proudly powered by WordPress

No comments:

Post a Comment