[squeak-dev] A (possible) way to play with a canvas from a workspace

karl ramberg karlramberg at gmail.com
Thu Mar 16 19:52:29 UTC 2023


Hi,
See two partly finished morphs in attachment that draw on canvas using
different routines

You can also draw to a form in a hackish way to make some generative art,
see example below.
Morphic is quite forgiving and will mostly work even if you break the rules
slightly :-)

brush := (Form extent: 1 at 1 depth: 32) fillBlack.
form := (Form extent:500 at 500 depth:32) fillWhite.
y := form extent y -60.
x := form extent x -60.
segments := 8 atRandom +3.
points := OrderedCollection new.
1 to: segments do:[:r|
points add: (x atRandom @ (y atRandom))+30].
points add: (points first copy).
0 to: 1 by: 0.01 do:[:j|
1 to: segments do:[:i|
form drawLine: brush
from: (points at:i) to: (points at:i+1)
clippingBox: form boundingBox
rule: Form paint fillColor: nil].
d := OrderedCollection new.
1 to: segments do:[:a|
                 d add: (points at: a) +(j * ((points at: a+1)-(points at:
a)))].
d add: (d first copy).

p := OrderedCollection new.
1 to: segments do:[:aa|

p add: (d at: aa) +(j * ((d at: aa+1)-(d at: aa)))].

p add: (p first copy).
1 to:segments do:[:b|
form drawLine: brush
from: (p at:b) to:  (p at:b+1)
clippingBox: form boundingBox
rule: Form paint fillColor: nil].

form displayAt:10 at 60.
(Delay forMilliseconds: 10) wait.
].

Best,
Karl

On Wed, Mar 15, 2023 at 11:28 PM Eduardo Ochs <eduardoochs at gmail.com> wrote:

> Hi list,
> (or: hi Karl, but I decided to include other people too),
>
> Karl, can you try this when you have some spare time, and tell me if
> this approach makes sense? "This" is this:
>
>   http://anggtwu.net/SQUEAK/Category-Edrx.st.html
>   http://anggtwu.net/SQUEAK/Category-Edrx.st
>
> After fileIn-ing that you will get a "Category-Edrx" with seven
> classes. The simplest way to explore them is by doing:
>
>   See see.
>
> I renamed the TestMorph class that you sent in this e-mail
>
>
> http://lists.squeakfoundation.org/pipermail/squeak-dev/2023-February/223535.html
>
> to TestCanvas, and if you run this
>
>   See edrxGuide: #testCanvas.
>
> you will see some - still very bare and messy - notes on how to debug
> this TestCanvas in a few different ways... I believe that it should be
> possible to draw other things in that TestCanvas in the help topic
> window using "tc" and "tc canvas", but I didn't have time to prepare
> the examples yet...
>
>   Cheers,
>     Eduardo Ochs
>     http://anggtwu.net/eev-squeak.html
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230316/e6627379/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BezierMorph.st
Type: application/octet-stream
Size: 2641 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230316/e6627379/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Drawing.st
Type: application/octet-stream
Size: 1558 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230316/e6627379/attachment-0001.obj>


More information about the Squeak-dev mailing list