cfdg.models.chiaroscuro: Use new macros

db4
Eduardo Cavazos 2008-08-06 14:23:50 -05:00
parent eeb22dafab
commit 833c608bec
1 changed files with 16 additions and 18 deletions

View File

@ -5,34 +5,32 @@ USING: kernel namespaces sequences math
IN: cfdg.models.chiaroscuro IN: cfdg.models.chiaroscuro
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
DEFER: white DEFER: white
: black ( -- ) iterate? [ : black ( -- )
{ { 60 [ [ 0.6 s circle ] do {
[ 0.1 x 5 r 0.99 s -0.01 b -0.01 a black ] do ] } { 60 [ 0.6 s circle ] [ 0.1 x 5 r 0.99 s -0.01 b -0.01 a black ] }
{ 1 [ white black ] } } { 1 [ white black ] }
call-random-weighted }
] when ; rules ;
: white ( -- ) iterate? [ : white ( -- )
{ { 60 [ {
[ 0.6 s circle ] do { 60 [ 0.6 s circle ] [ 0.1 x -5 r 0.99 s 0.01 b -0.01 a white ] }
[ 0.1 x -5 r 0.99 s 0.01 b -0.01 a white ] do { 1 [ black white ] }
] } }
{ 1 [ rules ;
black white
] } }
call-random-weighted
] when ;
: chiaroscuro ( -- ) [ 0.5 b black ] do ; : chiaroscuro ( -- ) { [ 0.5 b black ] } rule ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: init ( -- ) : init ( -- )
[ -0.5 b ] >background [ -0.5 b ] >background
{ -3 6 -2 6 } >viewport { -3 6 -2 6 } >viewport
0.01 >threshold 0.03 >threshold
[ chiaroscuro ] >start-shape ; [ chiaroscuro ] >start-shape ;
: run ( -- ) [ init ] cfdg-window. ; : run ( -- ) [ init ] cfdg-window. ;