×

Discussion Board

Results 1 to 15 of 15

Hybrid View

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    41

    How to move an object in a curve path

    i have a button that should moved from point1 to point2 where point1 and point2 are at the same y position but different x position , this is the code:


    animation = new QPropertyAnimation(ui->button, "geometry");
    animation->setDuration(time);
    animation->setStartValue(QRect(point1, size));
    animation->setEasingCurve(QEasingCurve::Linear);
    animation->setEndValue(QRect(point2,size));
    animation->start();
    my problem is that i want the moving path of the button from point1 to point2 is a semi circle or curve and not a line , how i can do that , plz help

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: How to move an object in a curve path

    Just a guess, but maybe you should use a different QEasingCurve value, like InCirc or OutCIrc.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    41

    Re: How to move an object in a curve path

    thanks for ur reply,
    when changing the value of QEasingCurve to InCirc or OutCIrc the acceleration of moving the button is change but its still moving in a linear path .
    i want the button to move in a curve path , any help?

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: How to move an object in a curve path

    Subclass QButton and implement a "myProp" property (see http://doc.qt.nokia.com/4.6-snapshot...-overview.html for how to do this). Animate just an integer or float value that goes from start to end, then, in the logic for setMyProp, compute your widget coordinates from that value.

  5. #5
    Registered User
    Join Date
    Nov 2010
    Posts
    41

    Re: How to move an object in a curve path

    thanks again,
    i am using geometry property , after i set start and end value the button move from point1 to point2 but its move in a line path, but i want the movement to be in a cure not linear.i can make sequence animation in diagonal path but also its still in a linear path .

    in this function animation->setEndValue(QRect(point2,size)); i use QRec , can i use a curve or other object ?
    Last edited by wehbi; 2010-11-26 at 12:26.

  6. #6
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: How to move an object in a curve path

    Yes, I know what you're using (it's in the code you posted). You're using the wrong thing, however.

Similar Threads

  1. how to move a m3g object
    By ronykucse in forum Mobile Java Games
    Replies: 1
    Last Post: 2010-02-05, 09:51
  2. Learning Curve
    By kashifrazzaqui in forum Symbian
    Replies: 0
    Last Post: 2008-04-13, 20:46
  3. DRM 2.0: Rights Object path
    By sunilckore in forum Digital Rights Management & Content Downloading
    Replies: 8
    Last Post: 2007-07-04, 15:50
  4. Curve Lines
    By anxamobile in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2006-03-10, 02:00
  5. How to implement Bezier Curve ?
    By gauravgandhi80 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2004-06-22, 07:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×