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. [solved] Strange behaviour when animating opacity
Forum Updated to NodeBB v4.3 + New Features

[solved] Strange behaviour when animating opacity

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 652 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.
  • D Offline
    D Offline
    digorydoo
    wrote on last edited by
    #1

    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...

    1 Reply Last reply
    0
    • D Offline
      D Offline
      digorydoo
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0

      • Login

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