Re: Question on Morphic drawOn: method.
Posted by
Sean P. DeNigris on
Feb 04, 2015; 8:30pm
URL: https://forum.world.st/Question-on-Morphic-drawOn-method-tp4803695p4803743.html
HilaireFernandes wrote
First you don't need to subclass EllipseMorph...
100 to: 50 by: -1 do: [ :x |
aBall
height: x;
bottom: 200 - x.
World doOneCycle]
Of course you can have the best of both worlds by using Morphic stepping in your subclass, like:
EllipseMorph subclass: #Ball
...
Ball>>#step
self
bottom: 200 - self nextHeight;
height: self nextHeight.
self bottom = 100 ifTrue: [ increment := -1 ].
self bottom = 150 ifTrue: [ increment := 1 ].
For full code:
Gofer it
smalltalkhubUser: 'SeanDeNigris' project: 'SeansPlayground';
package: 'Ball';
load.
Cheers,
Sean