Animation of a fan on a motor shaft? - Solved
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Animation of a fan on a motor shaft? - Solved
I am working on a learning app for electrical motor controls.
When the controls request the motor to run, I want a fan on the end of the motor to turn.
Currently I am changing the visibility of three groups of objects to give the appearance of rotation, but it is slow and choppy.
The visibility sequence is controlled by a "send back to me" instruction every 100 milliseconds.
Is there a better way?
Thanks,
David
When the controls request the motor to run, I want a fan on the end of the motor to turn.
Currently I am changing the visibility of three groups of objects to give the appearance of rotation, but it is slow and choppy.
The visibility sequence is controlled by a "send back to me" instruction every 100 milliseconds.
Is there a better way?
Thanks,
David
Last edited by DR White on Thu Feb 04, 2021 5:40 pm, edited 1 time in total.
Re: Animation of a fan on a motor shaft?
Why not just use an animated gif? Simplest solution I can think of.

Re: Animation of a fan on a motor shaft?
How is that done?
Re: Animation of a fan on a motor shaft?
Hi David,
I would take three screenshots from your groups and use this image as an ICON in a button and
set the icon sequentially like you did with show/hide the groups.
This animation will be much smoother!
Best
Klaus
I would take three screenshots from your groups and use this image as an ICON in a button and
set the icon sequentially like you did with show/hide the groups.
This animation will be much smoother!
Best
Klaus
Re: Animation of a fan on a motor shaft?
Thank You!
Re: Animation of a fan on a motor shaft?
Pretty simply, actually. I went and grabbed the first animated gif I could find of a fan turning, because I figure you have your own look for this in mind, so it is pretty crappy looking heh, but it is good enough for demonstration purposes.
All of the code is sitting in the card level.
All of the code is sitting in the card level.

Re: Animation of a fan on a motor shaft?
I love it when someone attaches an example!!
Why don't I see any code in your "on" and "Off' buttons?
Why don't I see any code in your "on" and "Off' buttons?
Re: Animation of a fan on a motor shaft?
Glad you liked it 
When I write something, though, whether it is for me or for someone else, I tend to centralize my code, i.e.. I tend to put it as far down the message path as I can, unless there is a specific reason not too.
Here is the same stack, single button, code in the button.

Well, for a few reasons, not the least of which being it isn't necessary to code the buttons, they are just there for the end user, and likely enough the end user would never be looking at the code. I could just as easily have used 1 button, and just changed it's text / label. Had I gone that way, the code probably would have been in the single button.
When I write something, though, whether it is for me or for someone else, I tend to centralize my code, i.e.. I tend to put it as far down the message path as I can, unless there is a specific reason not too.
Here is the same stack, single button, code in the button.

-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Animation of a fan on a motor shaft?
Personally I always open up an animated GIF with GIMP and export all the constituent frames as PNG images so
that I can control them more easily inwith LiveCode.
that I can control them more easily inwith LiveCode.
Re: Animation of a fan on a motor shaft?
Not quite sure how your control would be any greater or lesser than just using the gif ?

Re: Animation of a fan on a motor shaft?
I downloaded GIMP.
I opened gif with GIMP.
I see the all the constituent frames.
Don't see how to export into individual frames.
I opened gif with GIMP.
I see the all the constituent frames.
Don't see how to export into individual frames.
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Animation of a fan on a motor shaft?
https://www.dropbox.com/s/yvnkkca3c3vmn ... e.zip?dl=0
Stopping, Starting, speeding up, slowing down . . .
Re: Animation of a fan on a motor shaft?
There are a number of ways to do that, this is probably the easiest.
https://www.digitalcitizen.life/how-exp ... -gif-file/

Re: Animation of a fan on a motor shaft?
I see how richmond62 got the animation to work.
Pretty straight forward!
Thanks everyone so much!!
This forum is the BEST!!
Pretty straight forward!
Thanks everyone so much!!
This forum is the BEST!!

-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Animation of a fan on a motor shaft? - Solved
Not if you are running an OS other than Windoze.There are a number of ways to do that, this is probably the easiest.
https://www.digitalcitizen.life/how-exp ... -gif-file/
https://ezgif.com/split
macOS: https://apps.apple.com/us/app/gif-separ ... 8801?mt=12