XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 2nd, 2025, 2:55 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Stop Animate Float?
PostPosted: September 9th, 2012, 10:58 pm 
Offline
User avatar

Joined: August 29th, 2012, 2:34 am
Posts: 56
How to stop the animation of the given object after using the AnimateFloat( 8-) ) function ?? Also setTimeout( 8-) ) function is not responding... does somebody knows why?
Code:
    //There is no error while using setTimeout, but nothing happens
    setTimeout(function(){print(Sender.RotateAngle)},.4);

    //Animation code.
    Sender.AnimateFloat('RotateAngle', 15, .1);
    Sender.AnimateFloatDelay('RotateAngle', -15, .2, .1);
    Sender.AnimateFloatDelay('RotateAngle', 0, .1, .3);

_________________
Image


Top
 Profile  
 
 Post subject: Re: Stop Animate Float?
PostPosted: September 10th, 2012, 12:29 am 
Offline
User avatar

Joined: May 12th, 2012, 8:32 pm
Posts: 594
Code:
//call the "functionName" after 0.2 second
setTimeOut("functionName",200);


function functionName()
{
  print("hi"); 
}


_________________
XWidget Software Developer
[XWidget for Android] [Lastest version of XWidget] [Lastest patch of XWidget]
[XDesktop for Android/Windows]


Top
 Profile  
 
 Post subject: Re: Stop Animate Float?
PostPosted: September 10th, 2012, 2:40 am 
Offline
User avatar

Joined: August 29th, 2012, 2:34 am
Posts: 56
Thnk's tony. But I still don't know if its possible to stop the animation

_________________
Image


Top
 Profile  
 
 Post subject: Re: Stop Animate Float?
PostPosted: September 11th, 2012, 3:33 am 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
what do you mean stop? this animation just carry out once


Top
 Profile  
 
 Post subject: Re: Stop Animate Float?
PostPosted: September 13th, 2012, 7:58 pm 
Offline
User avatar

Joined: August 29th, 2012, 2:34 am
Posts: 56
When i start animation on mouse over it start to move for about 1-2 sec then when the mouse out a different animation is called. So each time i move the mouse in and out quickly the two animations are used in the same time and the result is looking wired, the image scales up and down in the same time.

Stopping the animation would be vary handy.

Code:
On mouse over - image.AnimateFloat("Scale.X",2,1.2);
On mouse out - image.AnimateFloat("Scale.X", 1,1.2);

//Some stooping animation code code?
image.StopAnimatingFloat();

_________________
Image


Top
 Profile  
 
 Post subject: Re: Stop Animate Float?
PostPosted: October 9th, 2012, 10:19 am 
Offline
User avatar

Joined: August 2nd, 2012, 12:43 am
Posts: 26
It's a bit of work, but you could use a variable to check if an animation is already happening before starting another animation, and have different variables for each shortcut. There might be an easier way to do it, but I came up with something like this:

Code:
animating1 = false;

function animate1(){
    if(animating1 == false){
        animating1  = true;
        image1.AnimateFloat('RotateAngle', 15, .1);
        image1.AnimateFloatDelay('RotateAngle', -15, .2, .1);
        image1.AnimateFloatDelay('RotateAngle', 0, .1, .3);
        setTimeout("SetAnimation1Done",400);
    }
}

function SetAnimation1Done(){
    animating1 = false;
}


And you could make that expandable that using the eval function, so that all the shortcuts can use the same function, but unless you could find a way to pass a parameter with setTimeout in Xwidget, you'd have to have a bunch of SetAnimationNDone functions, so it wouldn't be infinitely expandable. It's possible in regular Javascript, but as far as I've seen not for us because neither the nested function version nor the parameter version of setTimeout work in Xwidget. I'm gonna go post that in the feature suggestion forum right now...

_________________
deviantArt profile

My Widgets:
Game Specials v1.1


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 48 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group