Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8694845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:53:02+00:00 2026-06-13T00:53:02+00:00

I want to make a QML animation with QML Image element height property. But

  • 0

I want to make a QML animation with QML Image element height property.
But negative value for Image height property does not work in Timer.

Can you tell me what is wrong with this animation?

import QtQuick 1.1

Rectangle {
    width: 300
    height: 300

    property int mySize: 10

    Image {
        x: 150; y: 150
        width: 20
        height: -mySize       // animation does not work in Timer, Why?
        //height: mySize      // animation works in Timer
        source: "Bar.jpg"
    }
    Timer {
        interval: 200
        running: true
        repeat: true
        onTriggered: mySize +=5
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:53:03+00:00Added an answer on June 13, 2026 at 12:53 am

    First, (to answer your question), you can’t use negative sizes. Use scaling instead, which supports negative values.

    Scale {
        yScale: ...                // <-- change this value; 1 = original size
    
        Image {
            x: 150; y: 150
            width: 20; height: 10  // <-- use constant size
            source: "Bar.jpg"
        }
    }
    

    Second, you clearly should read about animations in QML. In QML, you don’t need timers to implement animations. The idea is that you only tell the start and end value of the property to be animated, and activate this animation. You can also configure the speed / duration of the animation and even the easing curve (to slow the animation down at the end and fancy stuff like bouncing…). One example could be:

    import QtQuick 1.1
    
    Rectangle {
        width: 300; height:300
    
        Scale {
            Image {
                x: 150; y: 150
                width: 20; height: 10
                source: "Bar.jpg"
            }
    
            NumberAnimation on yScale {
                from: 1
                to: -1
                running: ...     // <-- Animation is running while expression is true
            }
        }
    }
    

    Or, if you don’t want to use an expression with property binding on Animation.running, you can also use the methods Animation.start(), stop(), etc. (Set an id on the animation to make it addressable from JavaScript.)

    But understanding and working with property bindings in expressions is a major part of QML, so you should try to express what you want using expressions, not using method calls, events, conditions, whatever. That’s the way QML is and why it is beautiful. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Want make a mind map like the following: Image link is not available anymore.
I want make a xslt transformation to xsl-fo but I´m not really sure that
I want make a bash script which returns the position of an element from
I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same
I want make the control height as double when the mouse is over that
I want to make a class serializable but i dont want make serializable some
I want make application simple image editor in android . For the first I
i want make a popup window for login/signup. so i'v written this code. but
i want make a simple delete using Ajax but this dont works, i wantmake
I want make something like animation. I have four UIImageView (names: IW1, IW2, IW3,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.