[solved] Strange behaviour when animating opacity
-
The following code to animate opacity works:
@
id: root;
opacity: 1.0;
states:
[
State
{
name: "disappeared";
when: root.isDisappearing
}
]
transitions:
[
Transition
{
from: "*"; to: "disappeared";
NumberAnimation
{
target: root;
properties: "opacity";
from: 1.0; to: 0.0;
duration: 700;
easing.type: Easing.Linear;
}
}
]
@The following code to animate a colour works, too:
@
id: root;
states:
[
State
{
name: "disappeared";
when: root.isDisappearing
changes:
[
PropertyChanges { target: msgText; color: "#00000000"; }
]
}
]
transitions:
[
Transition
{
from: "*"; to: "disappeared";
ColorAnimation { duration: 700; easing.type: Easing.Linear; }
}
]
@However, the following code to animate opacity doesn't work, the result would directly jump to fully transparent:
@
id: root;
opacity: 1.0;
states:
[
State
{
name: "disappeared";
when: root.isDisappearing
changes:
[
PropertyChanges { target: root; opacity: 0.0; }
]
}
]
transitions:
[
Transition
{
from: "*"; to: "disappeared";
NumberAnimation { duration: 700; easing.type: Easing.Linear; }
}
]
@Why is this so? Feels like a bug to me...
-
Oops, I think I already figured it out... I forgot to mention properites: "opacity" in the NumberAnimation. Apparently, ColorAnimation assumes the targeted property is "color", while NumberAnimation can't know. Sorry for the stupid question! Cheers