[Squeakland] [Q]Some questions about scripting an eToy player

Darius Clarke DClarke at fadal.com
Fri Feb 6 11:05:02 PST 2004

Scott, Andreas,
Thank you. That helped.
I'll play with it some more.


-----Original Message-----
From: Scott Wallace [mailto:scott.wallace at squeakland.org] 
Sent: Wednesday, January 14, 2004 8:34 PM
To: Darius Clarke
Cc: squeakland at squeakland.org; Andreas Raab
Subject: RE: [Squeakland] Re: [Q]Some questions about scripting an eToy

Hi, Darius,

I don't have the perfect answer to your query (perhaps Andreas will) but
here are some observations that may be useful:

(1)  An easy way to achieve the effect you want, I think, would be to
capture your gradient-graced sphere as a SketchMorph.  The reason is
that there is a special feature available only to SketchMorphs that
allows you to specify that their appearance not change as they rotate.
To do this:

* First create your object as an EllipseMorph with gradient fill, as

* Then obtain a SketchMorph from it using one of the new morph...
grab... commands from the desktop menu.

* Remove the transparent pixels surrounding the resulting SketchMorph by
using painting... erase pixels of color.. from its halo menu.

* The result is a SketchMorph of exactly the same size and shape and
appearance as your original.

* Go to the SketchMorph's halo menu, choose painting... set rotation
style... don't rotate.

Now you have a ball whose appearance will not change as you change its
heading from a Viewer or from running code.

(2)  The intent of the rotation code is to take the *complete*
appearance of the object when facing in its "forward  direction" and to
rotate it rigidly by the required number of degrees.  That "complete"
appearance includes drop-shadow, gradient direction, etc.

What you are asking for is directly at odds with that.  If you don't
want to use the SketchMorph trick outlined above, then the best
alternative I can think of is for you to give the object a ticking
textual script that serves to counteract the effect of the rotation on
the gradient direction.  Though I couldn't immediately and without
careful thought write down a script that accomplished this, obviously it
must be possible, though perhaps strenuous.  The script would presumably
have code of the form "Sphere costume fillStyle direction: foo" or
something similar.

(3)  A further thought is:  if you want the appearance to be unchanged,
perhaps you shouldn't be changing the heading in the first place.  An
alternative is to forego the built-in heading-changing feature such as
"turn-by" and to do all your motion-related computations more directly
instead.  Though this obviously  has its price, and the resulting
scripts might be too obscure.

Hope these observations help, or at least don't hurt  ;-)


 -- Scott

This transmission contains information which may be legally privileged, proprietary in nature, or otherwise protected by law from disclosure, and is intended only for the use of the addressee(s) named above. If you are not the addressee, or the person responsible for delivering this to the addressee(s), you are hereby notified that reading, copying, or distributing this transmission is prohibited. If you have received this transmission in error, please telephone us immediately at 818-407-1400 and mail the transmission back to us at the above address.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://squeakland.org/pipermail/squeakland/attachments/20040206/52aa73c7/attachment.htm

More information about the Squeakland mailing list