XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2017年 Nov 24日 21:33

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Stop Animate Float?
PostPosted: 2012年 Sep 9日 22:58 
Offline
User avatar

Joined: 2012年 Aug 29日 02:34
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: 2012年 Sep 10日 00:29 
Offline
User avatar

Joined: 2012年 May 12日 20:32
Posts: 576
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: 2012年 Sep 10日 02:40 
Offline
User avatar

Joined: 2012年 Aug 29日 02:34
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: 2012年 Sep 11日 03:33 
Offline
User avatar

Joined: 2012年 Jun 10日 05:57
Posts: 315
what do you mean stop? this animation just carry out once


Top
 Profile  
 
 Post subject: Re: Stop Animate Float?
PostPosted: 2012年 Sep 13日 19:58 
Offline
User avatar

Joined: 2012年 Aug 29日 02:34
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: 2012年 Oct 9日 10:19 
Offline
User avatar

Joined: 2012年 Aug 2日 00:43
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 9 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