Animation
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 216
- Joined: Wed Feb 27, 2013 9:04 pm
Animation
Hello,
what is the best way to put animation in an App in LiveCode?
What I mean is something like that http://www.paintcodeapp.com, in section "Variables & Expressions", the roboter-arm such as.
what is the best way to put animation in an App in LiveCode?
What I mean is something like that http://www.paintcodeapp.com, in section "Variables & Expressions", the roboter-arm such as.
Re: Animation
I can't find a section that shows a robot arm, only a pair of blocks that resize together and a circle that moves in a sine wave.
The connection between these expressions seems to be a use case in LiveCode for virtual custom properties. This is not the only way, and maybe not even the best, but you can use the getprop and setprop handlers to take action when dealing with property changes on one object affecting another.
For instance
A sample stack is zipped and attached to show how you can chain actions on multiple objects according to the setting of only one property on one object. Change the width selection slider and see how the width of the wide rectangle changes along with the small rectangle always in proportion. There is no code on the wide rectangle at all.
Because the setProp handler does not pass the message, the custom property cWideness (yes I just wanted to distinguish it from the built in width property) is not actually set on the small rectangle. Hence it is a "virtual custom property".
The connection between these expressions seems to be a use case in LiveCode for virtual custom properties. This is not the only way, and maybe not even the best, but you can use the getprop and setprop handlers to take action when dealing with property changes on one object affecting another.
For instance
Code: Select all
setProp cWideness pWidth
set the width of me to pWidth
set the left of me to 20
set the width of graphic "grcWide" to pWidth * 2
set the left of graphic "grcWide" to 20
end cWideness
Because the setProp handler does not pass the message, the custom property cWideness (yes I just wanted to distinguish it from the built in width property) is not actually set on the small rectangle. Hence it is a "virtual custom property".
- Attachments
-
- virtual_custom_properties.livecode.zip
- (759 Bytes) Downloaded 189 times
Re: Animation
Well yes, the same principles apply. Set the virtual custom property of the "cAngle" and in the setProp cAngle handler you can get the passed parameter for that angle and use it to set the LargerAngle and any other angles according to the expression you define.
-
- Posts: 216
- Joined: Wed Feb 27, 2013 9:04 pm
Re: Animation
Ok, so I've to "connect" all elements by myself in LifeCode, right?
Re: Animation
Yes, as you do in paintcodeapp, but without a drag and drop interface.