[squeak-dev] Rotating Morphs; how to rotate about a point other than the centre of bounds?

Bob Arning arning315 at comcast.net
Fri Apr 7 02:43:24 UTC 2017


One more - with an arbitrary morph


     | secondHand flex pos elapsed start rads |

     pos _ 100 at 100.
     secondHand _ (StringMorph contents: 'seconds') color: Color magenta.
     flex _ TransformationMorph new.
     flex addMorph: secondHand.
     secondHand position: 0 at 0.
     flex position: pos.
     flex offset: secondHand position.
     flex openInWorld explore.
     start _ Time millisecondClockValue.
     [elapsed _ Time millisecondClockValue - start. elapsed < 60000] 
whileTrue: [
         rads _ Float twoPi * (elapsed \\ 60000) / 60000.
         flex angle: rads negated.
         World displayWorldSafely.
     ]


On 4/6/17 7:23 PM, tim Rowledge wrote:
> Thanks Bob,
>
>> On 06-04-2017, at 3:52 PM, Bob Arning <arning315 at comcast.net> wrote:
>>
>> | secondHand |
>> secondHand _ Morph new extent: 3 at 50; color: Color yellow.
>> holder _ Morph new extent: 1 at 1; position: 100 at 100.
>> secondHand bottomRight: 0 at 0.
>> holder openInWorld.
>> flex _ holder addFlexShell.
>> holder addMorph: secondHand.
>> 1 to: 30 do: [ :i |
>>      flex angle: Float pi * (i/30.0) negated.
>>      World displayWorldSafely.
>>      (Delay forSeconds: 1) wait
>> ].
>> flex explore
>
> That’s… interesting. So by putting the morph I care about into a ‘fake morph’ that doesn’t even enclose it and rotating that in a TransformationMorph it does pretty much what I need. Really clever and completely not what I’d ever expect.
>
> Has to be a more easily usable approach that we can come up with to do this, surely. What is the purpose of the entire rotationCenter thing if not to make it be the center of any following rotations?
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> May the bugs of many programs nest on your hard drive.
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170406/0bdc5b3b/attachment.html>


More information about the Squeak-dev mailing list