<div dir="ltr">Hi Lawson,<div><br></div><div>Actually smooth animation in Squeak is possible.  The best I've seen is at:</div><div><a href="http://www.zogotounga.net/comp/saucers.htm">http://www.zogotounga.net/comp/saucers.htm</a><br></div><div>This is pure squeak/morphic, using stepping.</div><div><br></div><div>This isn't to say there aren't issue lurking about, of course.</div><div><br></div><div>-cbc</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 12, 2017 at 3:41 PM, LEnglish <span dir="ltr"><<a href="mailto:LEnglish5@cox.net" target="_blank">LEnglish5@cox.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div>
<div><br></div><div><br></div>Because of garbage collection issues, smooth animation in Squeak isn’t really possible.</div><div><br></div><div>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><br></div><div>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><br></div><div>Lawson</div>
<br><div>
<div><span style="font-family:Verdana,Geneva,sans-serif;font-size:12px;background-color:rgb(246,246,239)">"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">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">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">-Brian Kernighan</p><p style="margin-top:8px;margin-bottom:0px;font-family:Verdana,Geneva,sans-serif;font-size:12px"><br></p></div><br class="m_3059700841316842135Apple-interchange-newline">
</div>
<br><div><blockquote type="cite"><span class=""><div>On Oct 12, 2017, at 11:18, Bert Freudenberg <<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>> wrote:</div><br class="m_3059700841316842135Apple-interchange-newline"></span><div><div dir="ltr"><span class=""><div style="font-family:arial,helvetica,sans-serif;font-size:small">No, you have to put that test in the step method, because it has to be checked every time the position changes.</div><div style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small">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 style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small">- Bert -</div></span><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Oct 12, 2017 at 7:39 PM, obrienj <span dir="ltr"><<a href="mailto:obrienj@protonmail.com" target="_blank">obrienj@protonmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><div>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></div></span><div class="m_3059700841316842135HOEnZb"><div class="m_3059700841316842135h5"><div class="m_3059700841316842135m_-5740672471129903137protonmail_signature_block m_3059700841316842135m_-5740672471129903137protonmail_signature_block-empty"><div class="m_3059700841316842135m_-5740672471129903137protonmail_signature_block-user m_3059700841316842135m_-5740672471129903137protonmail_signature_block-empty"><div><br></div></div><div class="m_3059700841316842135m_-5740672471129903137protonmail_signature_block-proton m_3059700841316842135m_-5740672471129903137protonmail_signature_block-empty"><br></div></div><div><br></div><blockquote class="m_3059700841316842135m_-5740672471129903137protonmail_quote" type="cite"><span class=""><div>-------- Original Message --------<br></div><div>Subject: Re: [Newbies] Animation question<br></div><div>Local Time: October 12, 2017 10:25 AM<br></div><div>UTC Time: October 12, 2017 5:25 PM<br></div><div>From: <a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a><br></div><div>To: obrienj <<a href="mailto:obrienj@protonmail.com" target="_blank">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">beginners@lists.squeakfoundat<wbr>ion.org</a>><br></div><div><br></div></span><div><div class="h5"><div dir="ltr"><div><span class="m_3059700841316842135m_-5740672471129903137colour" style="color:rgb(34,34,34)"><span class="m_3059700841316842135m_-5740672471129903137font" style="font-family:arial,sans-serif">On Thu, Oct 12, 2017 at 6:24 PM, obrienj </span></span><span class="m_3059700841316842135m_-5740672471129903137colour" style="color:rgb(34,34,34)"><span class="m_3059700841316842135m_-5740672471129903137font" style="font-family:arial,sans-serif"><<a href="mailto:obrienj@protonmail.com" target="_blank">obrienj@protonmail.com</a>></span></span><span class="m_3059700841316842135m_-5740672471129903137colour" style="color:rgb(34,34,34)"><span class="m_3059700841316842135m_-5740672471129903137font" style="font-family:arial,sans-serif"> wrote:</span></span><br></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" class="gmail_quote"><div>I am having difficulty getting the following example to work using either delay or step:<br></div><div><br></div><div>aMorph := Morph new. <br></div><div>aMorph position: (100@100).<br></div><div>aMorph openInWorld. <br></div><div>30 timesRepeat: [aMorph position: aMorph position +(1@0).
 Transcript show: 'test '; cr.]. <br></div><div>(aMorph position) >= (120@100) ifTrue: [aMorph color: Color yellow].<br></div><div>Transcript show: 'position: ', aMorph position; cr.<br></div><div><br></div><div>For example:<br></div><div><br></div><div>aMorph := Morph new. <br></div><div>aMorph position: (100@100). <br></div><div>aMorph openInWorld. <br></div><div>delay := Delay forMilliseconds: 20.<br></div><div>[30 timesRepeat: [aMorph position: aMorph position +(1@0). delay wait.].] fork. <br></div><div>(aMorph position) >= (110@100) ifTrue: [aMorph color: Color yellow].<br></div><div>Transcript show: 'position: ', aMorph position; cr.<br></div><div><br></div><div>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></div></blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div>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></div><div><br></div><div>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></div><div><br></div><div><div>| aMorph |<br></div><div>aMorph := Morph new openInWorld. <br></div><div>aMorph startStepping: #transformedBy: at: Time millisecondClockValue arguments: {MorphicTransform offset: -3 @ -3} stepTime: 200.<br></div><div><br></div><div>However, it's unlikely no existing method does your specific animation, so you indeed need to implement it, eg<br></div><div><br></div><div>step<br></div><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif">    self position: self position + (1@0).<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif">    (self position) >= (120@100) ifTrue: [self color: Color yellow].<br></div></div><div><br></div></div><div>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></div><div><br></div><div>- Bert -<br></div><div><br></div></div></div></div></div></blockquote><div><br></div></div></div></blockquote></div><br></div></div>
______________________________<wbr>_________________<br>Beginners mailing list<br><a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.<wbr>squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a><br></div></blockquote></div><br></div><br>______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.<wbr>squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div></div>