<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><span style="font-family:arial,sans-serif;color:rgb(34,34,34)">On Thu, Oct 12, 2017 at 6:24 PM, obrienj </span><span dir="ltr" style="font-family:arial,sans-serif;color:rgb(34,34,34)"><<a href="mailto:obrienj@protonmail.com" target="_blank">obrienj@protonmail.com</a>></span><span style="font-family:arial,sans-serif;color:rgb(34,34,34)"> wrote:</span><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">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.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">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:"</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><div class="gmail_default">| aMorph |</div><div class="gmail_default">aMorph := Morph new openInWorld. </div><div class="gmail_default">aMorph startStepping: #transformedBy: at: Time millisecondClockValue arguments: {MorphicTransform offset: -3 @ -3} stepTime: 200.</div><div><br></div><div>However, it's unlikely no existing method does your specific animation, so you indeed need to implement it, eg</div><div><br></div><div>step</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].</div></div><div><br></div></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">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.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">- Bert -</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div></div></div>