<div id="__MailbirdStyleContent" style="font-size: 12pt;font-family: calibri;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        <span style="font-family: calibri;">Hi Lawson,</span><div style="font-family: calibri;"><br></div><div style="font-family: calibri;">smooth animation in Squeak is indeed possible. :) I use the Animation [1] package in Widgets [2] and Vivide [3] to improve UX with several (simple) effects (sorry for the GIF artifacts):</div><div class="mb_sig"></div>
                                        
                                        <div><br></div><div><a href="https://imgur.com/a/FBDpY">https://imgur.com/a/FBDpY</a></div><div><br></div><div><div style="font-family: calibri;">Best,</div><div style="font-family: calibri;">Marcel</div><div style="font-family: calibri;"><br></div><div style="font-family: calibri;">[1] <a href="https://github.com/hpi-swa/animations" title="Klicken, um in einem neuen Fenster oder Tab zu öffnen
https://github.com/hpi-swa/animations" style="font-size: 12pt;line-height: 1.5">https://github.com/hpi-swa/animations</a></div><div style="font-family: calibri;">[2] <a href="https://github.com/hpi-swa/widgets" title="Klicken, um in einem neuen Fenster oder Tab zu öffnen
https://github.com/hpi-swa/widgets" style="font-size: 12pt;line-height: 1.5">https://github.com/hpi-swa/widgets</a></div><div style="font-family: calibri;">[3] <a href="https://github.com/hpi-swa/vivide" title="Klicken, um in einem neuen Fenster oder Tab zu öffnen
https://github.com/hpi-swa/vivide" style="font-size: 12pt;line-height: 1.5">https://github.com/hpi-swa/vivide</a></div></div><blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 13.10.2017 00:42:08 schrieb LEnglish <lenglish5@cox.net>:</p><br class=""><div class="">
<div class=""><br class=""></div><div class=""><br class=""></div>Because of garbage collection issues, smooth animation in Squeak isn’t really possible.</div><div class=""><br class=""></div><div class="">My little OpenGL spaceship firing a missile animation had this annoying pause every so-often, as the GC activated and froze the screen.</div><div class=""><br class=""></div><div class="">Was hoping that Craig Latta would release a minimal Spoon image that allowed me to load the OpenGL plugin code, because the GC in the minimal image took about 1/50th (or less) of the time that the complete image takes, but he got sidetracked with his Caffeine project.</div><div class=""><br class=""></div><div class="">Lawson</div>
<br class=""><div class="">
<div class=""><span style="font-family: verdana, geneva, sans-serif;font-size: 12px;background-color: rgb(246, 246, 239)" class="">"Debugging is twice as hard as writing the code in the first place.</span><p style="margin-top: 8px;margin-bottom: 0px;font-family: verdana, geneva, sans-serif;font-size: 12px" class="">Therefore, if you write the code as cleverly as possible, you are,</p><p style="margin-top: 8px;margin-bottom: 0px;font-family: verdana, geneva, sans-serif;font-size: 12px" class="">by definition, not smart enough to debug it."</p><p style="margin-top: 8px;margin-bottom: 0px;font-family: verdana, geneva, sans-serif;font-size: 12px" class="">-Brian Kernighan</p><p style="margin-top: 8px;margin-bottom: 0px;font-family: verdana, geneva, sans-serif;font-size: 12px" class=""><br class=""></p></div><br class="Apple-interchange-newline">
</div>
<br class=""><div><blockquote type="cite" class="" style="min-width: 500px"><div class="">On Oct 12, 2017, at 11:18, Bert Freudenberg <<a href="mailto:bert@freudenbergs.de" class="">bert@freudenbergs.de</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;font-size: 10pt">No, you have to put that test in the step method, because it has to be checked every time the position changes.</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;font-size: 10pt"><br class=""></div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;font-size: 10pt">Or you have to wait until the animation is done before doing the test - it does work in your first example with my "hack". It does not work in the second example because the forked code is executed after that test (plus forking is bad for this anyways).</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;font-size: 10pt"><br class=""></div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif;font-size: 10pt">- Bert -</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Oct 12, 2017 at 7:39 PM, obrienj <span dir="ltr" class=""><<a href="mailto:obrienj@protonmail.com" target="_blank" class="">obrienj@protonmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0 0 0 .8ex;border-left: 1px #ccc solid;padding-left: 1ex;min-width: 500px"><div class="">The problem is that I want use something like (self position) >= (120@100) ifTrue: [self color: Color yellow] outside of the step method. Even though the morph moves, it's position remains unchanged and the boolean tests false. Hope this makes sense.<br class=""></div><div class="HOEnZb"><div class="h5"><div class="m_-5740672471129903137protonmail_signature_block m_-5740672471129903137protonmail_signature_block-empty"><div class="m_-5740672471129903137protonmail_signature_block-user m_-5740672471129903137protonmail_signature_block-empty"><div class=""><br class=""></div></div><div class="m_-5740672471129903137protonmail_signature_block-proton m_-5740672471129903137protonmail_signature_block-empty"><br class=""></div></div><div class=""><br class=""></div><blockquote class="m_-5740672471129903137protonmail_quote" type="cite" style="min-width: 500px"><div class="">-------- Original Message --------<br class=""></div><div class="">Subject: Re: [Newbies] Animation question<br class=""></div><div class="">Local Time: October 12, 2017 10:25 AM<br class=""></div><div class="">UTC Time: October 12, 2017 5:25 PM<br class=""></div><div class="">From: <a href="mailto:bert@freudenbergs.de" target="_blank" class="">bert@freudenbergs.de</a><br class=""></div><div class="">To: obrienj <<a href="mailto:obrienj@protonmail.com" target="_blank" class="">obrienj@protonmail.com</a>>, A friendly place to get answers to even the most basic questions about Squeak. <<a href="mailto:beginners@lists.squeakfoundation.org" target="_blank" class="">beginners@lists.<wbr class="">squeakfoundation.org</a>><br class=""></div><div class=""><br class=""></div><div dir="ltr" class=""><div class=""><span class="m_-5740672471129903137colour" style="color:rgb(34,34,34)"><span class="m_-5740672471129903137font" style="font-family:arial,sans-serif">On Thu, Oct 12, 2017 at 6:24 PM, obrienj </span></span><span class="m_-5740672471129903137colour" style="color:rgb(34,34,34)"><span class="m_-5740672471129903137font" style="font-family:arial,sans-serif"><<a href="mailto:obrienj@protonmail.com" target="_blank" class="">obrienj@protonmail.com</a>></span></span><span class="m_-5740672471129903137colour" style="color:rgb(34,34,34)"><span class="m_-5740672471129903137font" style="font-family:arial,sans-serif"> wrote:</span></span><br class=""></div><div class="gmail_extra"><div class="gmail_quote"><blockquote style="margin: 0px 0px 0px 0.8ex;border-left: 1px solid rgb(204,204,204);padding-left: 1ex;min-width: 500px" class="gmail_quote"><div class="">I am having difficulty getting the following example to work using either delay or step:<br class=""></div><div class=""><br class=""></div><div class="">aMorph := Morph new. <br class=""></div><div class="">aMorph position: (100@100).<br class=""></div><div class="">aMorph openInWorld. <br class=""></div><div class="">30 timesRepeat: [aMorph position: aMorph position +(1@0).
 Transcript show: 'test '; cr.]. <br class=""></div><div class="">(aMorph position) >= (120@100) ifTrue: [aMorph color: Color yellow].<br class=""></div><div class="">Transcript show: 'position: ', aMorph position; cr.<br class=""></div><div class=""><br class=""></div><div class="">For example:<br class=""></div><div class=""><br class=""></div><div class="">aMorph := Morph new. <br class=""></div><div class="">aMorph position: (100@100). <br class=""></div><div class="">aMorph openInWorld. <br class=""></div><div class="">delay := Delay forMilliseconds: 20.<br class=""></div><div class="">[30 timesRepeat: [aMorph position: aMorph position +(1@0). delay wait.].] fork. <br class=""></div><div class="">(aMorph position) >= (110@100) ifTrue: [aMorph color: Color yellow].<br class=""></div><div class="">Transcript show: 'position: ', aMorph position; cr.<br class=""></div><div class=""><br class=""></div><div class="">In the first example the morph moves, changes color, and the Transcript shows its final position. However, in the second example the morph moves but does not change color and the Transcript shows its starting position.<br class=""></div></blockquote></div></div><div class="gmail_extra"><br class=""></div><div class="gmail_extra"><div class="">Morphic animation is based on stepping. That means, you don't move a Morph repeatedly in a loop, but Morphic tells your morph to update its position repeatedly.<br class=""></div><div class=""><br class=""></div><div class="">You need to make your own Morph subclass and implement a "step" method. Whenever that method is called, it moves the morph by a little. For example, you could use an existing method called" translateBy:"<br class=""></div><div class=""><br class=""></div><div class=""><div class="">| aMorph |<br class=""></div><div class="">aMorph := Morph new openInWorld. <br class=""></div><div class="">aMorph startStepping: #transformedBy: at: Time millisecondClockValue arguments: {MorphicTransform offset: -3 @ -3} stepTime: 200.<br class=""></div><div class=""><br class=""></div><div class="">However, it's unlikely no existing method does your specific animation, so you indeed need to implement it, eg<br class=""></div><div class=""><br class=""></div><div class="">step<br class=""></div><div class=""><div style="color:rgb(34,34,34);font-family:arial,sans-serif" class="">    self position: self position + (1@0).<br class=""></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif" class="">    (self position) >= (120@100) ifTrue: [self color: Color yellow].<br class=""></div></div><div class=""><br class=""></div></div><div class="">So this is the Right Way. Without bad hacks you cannot do meaningful animation from a workspace. There is a hack however: If you insert "World doOneCycle" in the while loop of your first example, it will actually work, because it will redraw the world in each loop. However, this would prevent two objects animating independently, that's why the design calls for the "step" method approach.<br class=""></div><div class=""><br class=""></div><div class="">- Bert -<br class=""></div><div class=""><br class=""></div></div></div></blockquote><div class=""><br class=""></div></div></div></blockquote></div><br class=""></div></div>
_______________________________________________<br class="">Beginners mailing list<br class=""><a href="mailto:Beginners@lists.squeakfoundation.org" class="">Beginners@lists.squeakfoundation.org</a><br class="">http://lists.squeakfoundation.org/mailman/listinfo/beginners<br class=""></div></blockquote></div><br class="">
                        </blockquote></div>