PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/cfdg/models/chiaroscuro/source.scm

http://github.com/dharmatech/abstracting
Scheme | 67 lines | 55 code | 10 blank | 2 comment | 0 complexity | 286ad2263fac1d2bcd5fb950d85dd519 MD5 | raw file
 1
 2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 3
 4(define (black)
 5  (when (iterate?)
 6        (call-random-weighted
 7         (vec
 8          (vec 60 (lambda ()
 9                    (block
10                     (lambda ()
11                       (size 0.6)
12                       (circle)))
13                    (block
14                     (lambda ()
15                       (x 0.1)
16                       (rotate 5)
17                       (size 0.99)
18                       (brightness -0.01)
19                       (alpha -0.01)
20                       (black)))))
21          (vec 1 (lambda ()
22                   (block
23                    (lambda ()
24                      (white)
25                      (black)))))))))
26
27(define (white)
28  (when (iterate?)
29        (call-random-weighted
30         (vec
31          (vec 60 (lambda ()
32                    (block
33                     (lambda ()
34                       (size 0.6)
35                       (circle)))
36                    (block
37                     (lambda ()
38                       (x 0.1)
39                       (rotate -5)
40                       (size 0.99)
41                       (brightness 0.01)
42                       (alpha -0.01)
43                       (white)))))
44          (vec 1 (lambda ()
45                   (block
46                    (lambda ()
47                      (black)
48                      (white)))))))))
49
50(define (chiaroscuro)
51  (when (iterate?)
52        (block
53         (lambda ()
54           (brightness 0.5)
55           (black)))))
56
57(set! *background* (lambda () (brightness -0.5)))
58
59(set! *viewport* (vec -3 6 -2 6))
60
61(set! *threshold* 0.03)
62
63(set! *start-shape* (lambda () (chiaroscuro)))
64
65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
66
67(run-model)