factor/extra/cfdg/models/chiaroscuro/chiaroscuro.factor

41 lines
859 B
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
USING: kernel namespaces sequences math
opengl.gl opengl.glu ui ui.gadgets.slate
random-weighted cfdg ;
IN: cfdg.models.chiaroscuro
DEFER: white
: black ( -- ) iterate? [
{ { 60 [ [ 0.6 s circle ] do
[ 0.1 x 5 r 0.99 s -0.01 b -0.01 a black ] do ] }
{ 1 [ white black ] } }
call-random-weighted
2007-09-20 18:09:08 -04:00
] when ;
: white ( -- ) iterate? [
{ { 60 [
[ 0.6 s circle ] do
[ 0.1 x -5 r 0.99 s 0.01 b -0.01 a white ] do
] }
{ 1 [
black white
] } }
call-random-weighted
2007-09-20 18:09:08 -04:00
] when ;
: chiaroscuro ( -- ) [ 0.5 b black ] do ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-08-04 22:14:53 -04:00
: init ( -- )
[ -0.5 b ] >background
{ -3 6 -2 6 } >viewport
0.01 >threshold
[ chiaroscuro ] >start-shape ;
: run ( -- ) [ init ] cfdg-window. ;
2007-09-20 18:09:08 -04:00
MAIN: run