Hi
I try to make a digital clock. I need to rotate the two hands of the clock. The graphic or image objects have their center point, well..., at the center of the object. If I rotate an object, it will rotate from its center. What I need is to move the center point on the left side to rotate the object from its left side. I can not see any information about how to move this "center" point. Any idea ?
Regards
Frédéric
How to move the center point of a graphic ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: How to move the center point of a graphic ?
Hi Frédéric,
I attach a stack that shows how to use the startAngle property of a circle/oval graphic to simulate a minute hand.
You have to set the arcAngle property of the oval graphic to 2 or 3 and the linesize to maybe 2 or 3 also.
There is a slider to make the hand move.
The same can be done for a hour hand.
This is easier than to reset all the points of a graphic. Since rotating around the bottomLeft point of a graphic is not possible. As you found out rotate always rotates around the center.
Kind regards
Bernd
I attach a stack that shows how to use the startAngle property of a circle/oval graphic to simulate a minute hand.
You have to set the arcAngle property of the oval graphic to 2 or 3 and the linesize to maybe 2 or 3 also.
There is a slider to make the hand move.
The same can be done for a hour hand.
This is easier than to reset all the points of a graphic. Since rotating around the bottomLeft point of a graphic is not possible. As you found out rotate always rotates around the center.
Kind regards
Bernd
- Attachments
-
- clockHand.livecode.zip
- (877 Bytes) Downloaded 314 times
Re: How to move the center point of a graphic ?
Thanks a lot. I upload the file and make some tests. Thanks again.
Frédéric
Frédéric
Re: How to move the center point of a graphic ?
If did not miss anything, the idea is to make a transparent squared graphic with only the minute hand drawn from the center of graphic to the right side. Then use the startAngle command to change the angle of the graphic through one line of code ?
amazing.
Frédéric
amazing.
Frédéric
Re: How to move the center point of a graphic ?
Hi Frédéric,
Well you will more lines of code to calculate the angle from the minutes/hours and all that stuff but to set the angle it is one line of code. Actually Livecode calls this an oval graphic, which in this case is round. In the property inspector for the oval graphic you see the arcangle and the startangle property. You can set it there manually, or in your case by script.
Kind regards
Bernd
Yes, that is the idea.If did not miss anything, the idea is to make a transparent squared graphic with only the minute hand drawn from the center of graphic to the right side. Then use the startAngle command to change the angle of the graphic through one line of code ?
Well you will more lines of code to calculate the angle from the minutes/hours and all that stuff but to set the angle it is one line of code. Actually Livecode calls this an oval graphic, which in this case is round. In the property inspector for the oval graphic you see the arcangle and the startangle property. You can set it there manually, or in your case by script.
Kind regards
Bernd