Well, you have seen that before. But when you clicked on that text, what actually went on was that the text sent a message to the Rectangle to change its color. We can also do that. Select the following text and click 'cmd-d' (Mac) or 'ctrl-d' (Windows/Linux):
$morph('example-rectangle').changeColor()
That was an example of sending a message (changeColor) to an Object (the rectangle). In fact, it was really sending two messages to two different objects. The first message, $morph was sent to the world -- it said "find me an Object named example-rectangle". The world then returned the rectangle, and we told it to change color.
Let's try sending some other messages. How about:
$morph('example-rectangle').setExtent(pt(150,150 ))
As you can guess, the pt(150, 150) told the rectangle how big to be. pt(150, 150) is another object -- it's a point, with x coordinate 150 and y coordinate 150. Change the x and y values to change the size of the rectangle...
$morph('example-rectangle').setExtent(pt(50,50 ))
How about rotating it?
$morph('example-rectangle').setRotation(Math.PI/4)
Notice that we use radians (2 PI is a complete circle) rather than degrees...
And moving it?
$morph('example-rectangle').setPosition(pt(40,40))
Some messages make the object send back a value....we use cmd-p (ctrl-p) to see the value. Try this
$morph('example-rectangle').getPosition()
...or this...
$morph('example-rectangle').getRotation()
note again it's in radians. For degrees,
$morph('example-rectangle').getRotation() * 180/Math.PI
...or this...
Math.PI/4
...or this...
3/2