[etoys-dev] Sketch Divider
yoshiki at vpri.org
Mon Jul 27 13:49:17 EDT 2009
This is the project I showed at Squeakfest. It creates separeted
sketches from a sketch based on the color.
There is instruction in the project, but here it is:
- Make a painting. Use several different colors in the painting.
- Set the "target" variable of the DoIt object to the new painting.
One way to do it is to get halo of the sketch, click on the
orange tile handle and drop it onto the "dot" in the script below
and execute the script.
Or, open the viewer of the DoIt object, click on the readout of
the target variable (the cursor changes to a cross hair shape)
and click on the new painting.
- Press the blue and red "Do it" button. and the Sketch are divided
based on the same color.
The code is written textually and uses some Squeak tricks. Basically,
you can query a sketch the list of colors it uses. So, after
getting the list of colors, it takes each color from the list, replace
all other colors from the sketch with the transparent color, and make
a new sketch for each color. There would be a more fun Etoys way, but
that is homework for others...
More information about the etoys-dev