]> gitweb.factorcode.org Git - factor-unmaintained.git/blobdiff - cfdg/models/chiaroscuro/chiaroscuro.factor
unmaintained: New home for misfit Factor vocabularies.
[factor-unmaintained.git] / cfdg / models / chiaroscuro / chiaroscuro.factor
diff --git a/cfdg/models/chiaroscuro/chiaroscuro.factor b/cfdg/models/chiaroscuro/chiaroscuro.factor
new file mode 100644 (file)
index 0000000..d0474cd
--- /dev/null
@@ -0,0 +1,38 @@
+
+USING: kernel namespaces sequences math
+       opengl.gl opengl.glu ui ui.gadgets.slate
+       random-weighted cfdg ;
+
+IN: cfdg.models.chiaroscuro
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+DEFER: white
+
+: black ( -- )
+  {
+    { 60 [ 0.6 s circle ] [ 0.1 x 5 r 0.99 s -0.01 b -0.01 a black ] }
+    {  1 [ white black ]                                             }
+  }
+  rules ;
+
+: white ( -- )
+  {
+    { 60 [ 0.6 s circle ] [ 0.1 x -5 r 0.99 s 0.01 b -0.01 a white ] }
+    {  1 [ black white ] }
+  }
+  rules ;
+
+: chiaroscuro ( -- ) { [ 0.5 b black ] } rule ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+  [ -0.5 b ]      >background
+  { -3 6 -2 6 }   >viewport
+  0.03            >threshold  
+  [ chiaroscuro ] >start-shape ;
+
+: run ( -- ) [ init ] cfdg-window. ;
+
+MAIN: run