Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Programming morphs - page 3 - position, extent, color
Last updated at 2:17 pm UTC on 7 January 2022
Previous
Page 3 shows two blue morphs.

Three of the most basic features of a morph is its position, its extent, and its color.

position - the location of the morph, usually in screen coordinats where 0@0 is at the top left of the screen.

extent - the size of the morph, expressed as a point whose x-coordinate is the width and whose y-coordinate is the height.

color - the general color of the morph. Different morphs interpret this in their own way.


Try it yourself!

 joe position.  "print this"
 joe position: (joe position + (10@0)).
 
 joe extent.
 joe extent: (joe extent  1.1).
 
 
 joe color: Color yellow.
 joe color: Color green.


Now, see if you can write a command that makes jane move to a position 100 pixels to the right of joe.

 jane position: ("...you fill this part in...")

Test your code by dragging joe and jane around with the mouse, and then executing your line of code again.


 "——-"
 "joe := Morph new openInWorld"
 "jane := Morph new openInWorld".


Next