[Interest] Animating a gradient
Gianluca
gmaxera at gmail.com
Tue Nov 17 22:16:00 CET 2015
Hello Jason,
why you don’t simple use property binding ?
GradientStop { id: gs2; position: gs1.position+0.1; color: "dodgerblue" }
and remove completely onPositionChanged
Ciao,
Gianluca.
Il giorno 17/nov/2015, alle ore 20:39, Jason H <jhihn at gmx.com> ha scritto:
> I want to animate a gradient, but onPositionChanged gives an error, even though I can animate it. What am I doing wrong?
>
>
> Item {
> property alias color: container.color
> Component.onCompleted: anim.start()
> Rectangle {
> id: container
> width: parent.width * .9
> height : parent.height / 2
> anchors.centerIn: parent
> Rectangle {
> anchors.centerIn: parent
> width: container.height /2
> height: container.width
> rotation: -90
> gradient:Gradient {
> GradientStop { id: gs0; position: 0.00; color: "dodgerblue" }
> GradientStop {
> id: gs1;
> position: 0.98;
> color: "white";
> onPositionChanged: { // Cannot assign to non-existent property "onPositionChanged"
> gs2.position = position +.01
> }
> }
> GradientStop { id: gs2; position: 0.99; color: "dodgerblue" }
> GradientStop { id: gs3; position: 1.00; color: "dodgerblue" }
> }
> }
> }
>
> NumberAnimation {
> id: anim
> target: gs1
> property: "position"
> duration: 2000
> easing.type: Easing.InOutQuad
> loops: Animation.Infinite
> from: .98
> to: 0
> }
> }
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list