Login  Register

Re: Question on Morphic drawOn: method.

Posted by nacho on Feb 04, 2015; 8:46pm
URL: https://forum.world.st/Question-on-Morphic-drawOn-method-tp4803695p4803749.html

Great! Thanks.
It works perfectly in Pharo 3 but not in Pharo 4.
I thought that the drawOn: aCanvas was mandatory.
I'm so lost in morphic.
Trying to understand the logic of it slowly.
Unfortunately there seems to be little documentation and a lot of what is there does not work in Pharo 3 or 4.
Thanks again for taking the time!
Best
Nacho


Lic. Ignacio Sniechowski, MBA
Prosavic SRL

Tel: (011) 4542-6714





















On Wed, Feb 4, 2015 at 5:30 PM, Sean P. DeNigris [via Smalltalk] <[hidden email]> wrote:
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



If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Question-on-Morphic-drawOn-method-tp4803695p4803743.html
To unsubscribe from Question on Morphic drawOn: method., click here.
NAML

Nacho Smalltalker apprentice. Buenos Aires, Argentina.