Rotating a graphic 360degrees in 60s
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Rotating a graphic 360degrees in 60s
Yikes.
That worked. Great idea. "Points" is not included in the dictionary list of "effective" properties. It certainly should be. And the main purpose of the keyword itself is to allow a control to distinguish either inherited properties or locally set ones. I wonder what other properties there are that are not on that list.
Even with a 3600 side graphic that is 40 cm in diameter some adjacent points are duplicated.
I wonder if the OP is still watching this.
Craig
That worked. Great idea. "Points" is not included in the dictionary list of "effective" properties. It certainly should be. And the main purpose of the keyword itself is to allow a control to distinguish either inherited properties or locally set ones. I wonder what other properties there are that are not on that list.
Even with a 3600 side graphic that is 40 cm in diameter some adjacent points are duplicated.
I wonder if the OP is still watching this.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Rotating a graphic 360degrees in 60s
Bernd.
[quoteset the dashes of grc "hand" to the width of grc "ellipse"/2 - 35,250,0,250,0
]lets me hide a 600 pixel long line graphic except for the first part. So it seems that the limit applies to the dash interval not the absolute length of the hidden part of the line.[/quote]
What you did was set the width of the first solid dash, then a nice long blank, then a 0 width second dash, then another long blank, etc. So you kludged a solid, then two 250-limited blanks with "no" solid in between.
Nice.
Craig
[quoteset the dashes of grc "hand" to the width of grc "ellipse"/2 - 35,250,0,250,0
]lets me hide a 600 pixel long line graphic except for the first part. So it seems that the limit applies to the dash interval not the absolute length of the hidden part of the line.[/quote]
What you did was set the width of the first solid dash, then a nice long blank, then a 0 width second dash, then another long blank, etc. So you kludged a solid, then two 250-limited blanks with "no" solid in between.
Nice.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Rotating a graphic 360degrees in 60s
So here is a down and dirty second hand. It does not exactly make one revolution per minute. That needs refinement of the effective points of the large graphic, whereas right now it is using a simple wait command. It uses the "rect" method.
But it is pretty smooth.
Craig
But it is pretty smooth.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Rotating a graphic 360degrees in 60s
Craig,
That moves very smoothly. Nice.
I occured to me that a clockface could be oval. For that I did a version that dynamically changed dashes to let the seconds hand keep the same distance from the ellipse. That however ran into the 1 pixels problem (rounding problem) and one noticed a change in distance by 1 pixel while moving.
I gave up on dashes and decided a strokeGradient would be smoother. Which in fact it turned out to be.
I set a radial stroke gradient that has the coordinates of the ellipse and which has a gradient stop that is transparent. That cuts the handle visually off and adapts smoothly to the ellipse when changing length of handle.
For me that is the most versatile solution regarding display of seconds smoothly on a round or oval clock face.
(change graphic "ellipse" to see the effect.)
Kind regards
Bernd
That moves very smoothly. Nice.
I occured to me that a clockface could be oval. For that I did a version that dynamically changed dashes to let the seconds hand keep the same distance from the ellipse. That however ran into the 1 pixels problem (rounding problem) and one noticed a change in distance by 1 pixel while moving.
I gave up on dashes and decided a strokeGradient would be smoother. Which in fact it turned out to be.
I set a radial stroke gradient that has the coordinates of the ellipse and which has a gradient stop that is transparent. That cuts the handle visually off and adapts smoothly to the ellipse when changing length of handle.
For me that is the most versatile solution regarding display of seconds smoothly on a round or oval clock face.
(change graphic "ellipse" to see the effect.)
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Rotating a graphic 360degrees in 60s
Bernd.
So much fun.
There is an issue with an ellipse, in that the rotational speed of the hand is greater near the major axis and slows as it approaches the minor axis.
I am going to try to find a way (just because, since I do not know if the OP cares about it) to make the circular second hand actually take exactly one minute per revolution. No "wait" gadget will, on its own, do. I will try to set the endpoint changes based on interrogating the milliseconds, or maybe even the long milliseconds, and take a "step" based on those values. Should be easy, but I hope it will not introduce any visible jerkiness.
Craig
So much fun.
There is an issue with an ellipse, in that the rotational speed of the hand is greater near the major axis and slows as it approaches the minor axis.
I am going to try to find a way (just because, since I do not know if the OP cares about it) to make the circular second hand actually take exactly one minute per revolution. No "wait" gadget will, on its own, do. I will try to set the endpoint changes based on interrogating the milliseconds, or maybe even the long milliseconds, and take a "step" based on those values. Should be easy, but I hope it will not introduce any visible jerkiness.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Rotating a graphic 360degrees in 60s
Craig,dunbarx wrote: ↑Sat Nov 14, 2020 5:23 pmBernd.
So much fun.
There is an issue with an ellipse, in that the rotational speed of the hand is greater near the major axis and slows as it approaches the minor axis.
I am going to try to find a way (just because, since I do not know if the OP cares about it) to make the circular second hand actually take exactly one minute per revolution. No "wait" gadget will, on its own, do. I will try to set the endpoint changes based on interrogating the milliseconds, or maybe even the long milliseconds, and take a "step" based on those values. Should be easy, but I hope it will not introduce any visible jerkiness.
Craig
The examples I posted are synchronized using the milliseconds to exactly take one minute to complete the round trip. They are exact to the second.
The last one is easy to integrate into the "clock" Glenn (the OP) was referring to.
I thought it was a feature... That is easy to change by setting the "To" and "via" of the stroke gradient. Change the -- marked commentsThere is an issue with an ellipse, in that the rotational speed of the hand is greater near the major axis and slows as it approaches the minor axis.
Code: Select all
## give grc hand a strokeGradient that limits its visibility and adapts to ellipse
put "radial" into tArray["type"]
put x0,y0 into tArray["from"]
put min(the right of graphic "ellipse" - x0, the bottom of grc "ellipse" - y0) into tMinExtend -- add this
put x0, y0 + tMinExtend into tArray["to"] -- change this
put x0 + tMinExtend, y0 into tArray["via"] -- change this
-- put x0,the bottom of graphic "ellipse" into tArray["to"] -- block this
-- put the right of graphic "ellipse", y0 into tArray["via"] -- block this
## define two gradient stops
Bernd