How to rotate an object 360 degree?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

How to rotate an object 360 degree?

Post by ahmedinvent24BUSGdU9 » Tue Feb 19, 2013 7:53 pm

Hi, All
Please help!

How to rotate an object 360 degree with wheel effects?! :)

Thanks,
AhmedF.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: How to rotate an object 360 degree?

Post by Simon » Tue Feb 19, 2013 9:37 pm

Look up "angle" in the dictionary.
With a repeat loop you can make it go round and round.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

Re: How to rotate an object 360 degree?

Post by ahmedinvent24BUSGdU9 » Wed Feb 20, 2013 12:27 pm

Thank you Simon for your help, but sorry that doesn't work :(

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to rotate an object 360 degree?

Post by Klaus » Wed Feb 20, 2013 12:30 pm

Hi Ahmed,

maybe you should explain first what you mean with "a wheel effect" :D
Nevertheless I have the feeling that this will not be possible with the build-in means of Livecode.


Best

Klaus

ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

Re: How to rotate an object 360 degree?

Post by ahmedinvent24BUSGdU9 » Wed Feb 20, 2013 1:02 pm

Hi, Klaus
I mean to rotate, for example the fan rotating.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to rotate an object 360 degree?

Post by Klaus » Wed Feb 20, 2013 1:06 pm

Hi Ahmed,

yes, sure 8)
And to "rotate" an image you set its "angle" property!

What are we missing?


Best

Klaus

ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

Re: How to rotate an object 360 degree?

Post by ahmedinvent24BUSGdU9 » Wed Feb 20, 2013 1:15 pm

Hi,Klaus
Ok but how to repeat?!

Thanks,
AhmedF.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to rotate an object 360 degree?

Post by Klaus » Wed Feb 20, 2013 1:41 pm

Hi Ahmed,

well, maybe a "repeat" loop? :D

On the other hand I am sure you could simply FAKE that look like this:
Create a couple of separate images which represent the current "rotation" and then use a button's icon
to show these X images continuously instead of a FULL rotation of an image.

I will try to create a little example stack a bit later...


Best

Klaus

ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

Re: How to rotate an object 360 degree?

Post by ahmedinvent24BUSGdU9 » Wed Feb 20, 2013 1:45 pm

Hi Klaus,

Thank you For your help :)
I am waiting to see the sample stack :D



Thanks,
AhmedF.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to rotate an object 360 degree?

Post by Klaus » Wed Feb 20, 2013 2:07 pm

Hi Ahmed,

OK, finished, check the card script, I think this is what you are looking for! :D


Best

Klaus
Attachments
wheel_animation1.rev.zip
(95.92 KiB) Downloaded 541 times

ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

Re: How to rotate an object 360 degree?

Post by ahmedinvent24BUSGdU9 » Wed Feb 20, 2013 2:40 pm

WOW! Thats great and simple!

Thank You Klaus for your great effort :)

Best Regards,
AhmedF.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to rotate an object 360 degree?

Post by Klaus » Wed Feb 20, 2013 3:49 pm

Hi Ahmed,

glad you like it!
As you see, we are simply selling an illusion (of a rotating wheel) here :D

The technique of using "send X in ..." is very efficient, since it does not BLOCK like an repeat loop.
Try to get accustomed to this, very important for smooth animations!!


Best

Klaus

ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

Re: How to rotate an object 360 degree?

Post by ahmedinvent24BUSGdU9 » Fri Mar 22, 2013 4:29 pm

Thanks, Klaus
Really that is great way to make cool animation !
I use it in all apps i programmed to give it an animation!

Thanks again :wink:

Best Regards

Ahmed F.

William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Contact:

Re: How to rotate an object 360 degree?

Post by William Jamieson » Sat Aug 10, 2013 2:54 am

Wow that really is a good way to allow constant animation while not holding up the script at all since in the wait time, the rest of the script will be processing. I am defintely going to use this!

tomBTG
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Fri Nov 25, 2011 6:42 pm

Re: How to rotate an object 360 degree?

Post by tomBTG » Wed Aug 28, 2013 5:29 pm

Hi Klaus.

Would you entertain a few follow-up questions about your stack?

1) Being a newbie, I would have written a similar stack using handlers. You used "command". What's the difference? (The LC dictionary doesn't help much on this point.)
2) What is the result you are getting back from the "send" message in lin 19 and 20? I tried to view it as a variable and did not see it. You stored it in tAnimationMessage and used it to cancel the operation. Is it a message ID?
3) You end the animation_stop with "enable btn "animate" of cd 1". What is the reason for that? (Did the animation process disable the button?)

Thanks Klaus!
Tom

Post Reply