XWidgetSoft Forum https://www.bbs.xwidget.com/ |
|
Stop Animate Float? https://www.bbs.xwidget.com/viewtopic.php?f=10&t=2102 |
Page 1 of 1 |
Author: | vlad [ September 9th, 2012, 10:58 pm ] |
Post subject: | Stop Animate Float? |
How to stop the animation of the given object after using the AnimateFloat( ![]() ![]() 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); |
Author: | Tony [ September 10th, 2012, 12:29 am ] |
Post subject: | Re: Stop Animate Float? |
Code: //call the "functionName" after 0.2 second
setTimeOut("functionName",200); function functionName() { print("hi"); } |
Author: | vlad [ September 10th, 2012, 2:40 am ] |
Post subject: | Re: Stop Animate Float? |
Thnk's tony. But I still don't know if its possible to stop the animation |
Author: | qiancang [ September 11th, 2012, 3:33 am ] |
Post subject: | Re: Stop Animate Float? |
what do you mean stop? this animation just carry out once |
Author: | vlad [ September 13th, 2012, 7:58 pm ] |
Post subject: | Re: Stop Animate Float? |
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(); |
Author: | Sooner266 [ October 9th, 2012, 10:19 am ] |
Post subject: | Re: Stop Animate Float? |
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... |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |