Browse Source

updated some sketches with terser syntax

Inderjit Gill 1 month ago
parent
commit
2ebb24382d

+ 55
- 60
server/static/seni/sketch/1924-hand-submission.seni View File

@@ -1,6 +1,3 @@
1
-(meta linear-colour-space: 1)
2
-
3
-
4 1
 (define
5 2
   texture "hand.png"
6 3
   bmx (interp/build from: [0 canvas/width] to: [0 (bitmap/width from: texture)])
@@ -41,29 +38,29 @@
41 38
 
42 39
 (fn (left-side x: 0 y: 0 w: 0 h: 0 colour: red strength: 1)
43 40
   (define col (col/set-alpha value: strength
44
-                          from: (col/set-e1 value: (* 100 strength)
45
-                                            from: (col/convert format: HSLuv from: colour))))
41
+                             from: (col/set-e1 value: (* 100 strength)
42
+                                               from: (colour.col/convert format: HSLuv))))
46 43
   (on-matrix-stack
47 44
     (translate vector: [x y])
48
-    (rotate angle: (prng/value from: ra))
49
-    (left x: 0 y: 0 w: w h: h colour: col)
45
+    (rotate angle: (ra.prng/value))
46
+    (left x: 0 y: 0 w h colour: col)
50 47
     (loop (i to: 3)
51 48
       (scale scalar: sc)
52
-      (rotate angle: (prng/value from: ra))
53
-      (left x: 0 y: 0 w: w h: h colour: col))))
49
+      (rotate angle: (ra.prng/value))
50
+      (left x: 0 y: 0 w h colour: col))))
54 51
 
55 52
 (fn (right-side x: 0 y: 0 w: 0 h: 0 colour: red strength: 1)
56 53
   (define col (col/set-alpha value: strength
57
-                          from: (col/set-e1 value: (* 100 strength)
58
-                                            from: (col/convert format: HSLuv from: colour))))
54
+                             from: (col/set-e1 value: (* 100 strength)
55
+                                               from: (colour.col/convert format: HSLuv))))
59 56
   (on-matrix-stack
60 57
     (translate vector: [x y])
61
-    (rotate angle: (prng/value from: ra))
62
-    (right x: 0 y: 0 w: w h: h colour: col)
58
+    (rotate angle: (ra.prng/value))
59
+    (right x: 0 y: 0 w h colour: col)
63 60
     (loop (i to: 3)
64 61
       (scale scalar: sc)
65
-      (rotate angle: (prng/value from: ra))
66
-      (right x: 0 y: 0 w: w h: h colour: col))))
62
+      (rotate angle: (ra.prng/value))
63
+      (right x: 0 y: 0 w h colour: col))))
67 64
 
68 65
 (fn (tri-lab alpha: 1)
69 66
   (define
@@ -72,31 +69,25 @@
72 69
     colour-scale {771 (gen/int min: 700 max: 900)}
73 70
     colour-offset (prng/build min: -1 max: 1)
74 71
     li (interp/build from: [0 1]
75
-                     to: [{68 (gen/int min: 40 max: 120)}
76
-                          {11 (gen/int min: 0 max: 70)}])
72
+                     to: [{68 (gen/int min: 40 max: 120)} {11 (gen/int min: 0 max: 70)}])
77 73
     rma (interp/build from: [0 canvas/width]
78
-                      to: [{9 (gen/int min: -10 max: 30)}
79
-                           {29 (gen/int min: -10 max: 30)}])
74
+                      to: [{9 (gen/int min: -10 max: 30)} {29 (gen/int min: -10 max: 30)}])
80 75
     rmb (interp/build from: [0 canvas/height]
81
-                      to: [{96 (gen/int min: 60 max: 120)}
82
-                           {8 (gen/int min: 0 max: 60)}]))
76
+                      to: [{96 (gen/int min: 60 max: 120)} {8 (gen/int min: 0 max: 60)}]))
83 77
 
84 78
   (loop (y from: 0 to: canvas/height inc: (* 2 h))
85 79
     (loop (x from: 0 to: canvas/width inc: (* 4 w))
86 80
       (define
87
-        col-bm (bitmap/value from: texture position: [(interp/value from: bmx t: x)
88
-                                                      (interp/value from: bmy t: y)])
89
-        b (interp/value from: rmb t: (+ y (* (prng/value from: colour-offset) colour-scale)))
90
-        col-1 (col/lab l: (interp/value from: li t: (prng/value from: r))
91
-                       a: (interp/value from: rma t: (+ x (* (prng/value from: colour-offset) colour-scale)))
92
-                       b: b
93
-                       alpha: alpha)
94
-        col-2 (col/lab l: (interp/value from: li t: (prng/value from: r))
95
-                       a: (interp/value from: rma t: (+ x w (* (prng/value from: colour-offset) colour-scale)))
96
-                       b: b
97
-                       alpha: alpha))
98
-      (left-side  x: x         y: y w: w h: h colour: col-1 strength: (col/e0 from: col-bm))
99
-      (right-side x: (+ x w w) y: y w: w h: h colour: col-2 strength: (col/e0 from: col-bm)))))
81
+        col-bm (texture.bitmap/value position: [(bmx.interp/value t: x)
82
+                                                (bmy.interp/value t: y)])
83
+        strength (col-bm.col/e0)
84
+        l (li.interp/value t: (r.prng/value))
85
+        a (rma.interp/value t: (+ x (* (colour-offset.prng/value) colour-scale)))
86
+        b (rmb.interp/value t: (+ y (* (colour-offset.prng/value) colour-scale)))
87
+        col-1 (col/lab l a b alpha)
88
+        col-2 (col/lab l a b alpha))
89
+      (left-side  x            y w h colour: col-1 strength)
90
+      (right-side x: (+ x w w) y w h colour: col-2 strength))))
100 91
 
101 92
 (fn (tri-hsl alpha: 1)
102 93
   (define
@@ -112,15 +103,18 @@
112 103
   (loop (y from: 0 to: canvas/height inc: (* 2 h))
113 104
     (loop (x from: 0 to: canvas/width inc: (* 4 w))
114 105
       (define
115
-        col-bm (bitmap/value from: texture position: [(interp/value from: bmx t: x)
116
-                                                      (interp/value from: bmy t: y)])
117
-        b  (interp/value from: fn-l t: (+ y (* (prng/value from: colour-offset) colour-scale)))
118
-        col-1 (col/hsl h: (interp/value from: fn-h t: (+ x (* (prng/value from: colour-offset) colour-scale)))
119
-                       s: 1 l: b alpha: alpha)
120
-        col-2 (col/hsl h: (interp/value from: fn-h t: (+ x w (* (prng/value from: colour-offset) colour-scale)))
121
-                       s: 1 l: b alpha: alpha))
122
-      (left-side  x: x         y: y w: w h: h colour: col-1 strength: (col/e0 from: col-bm))
123
-      (right-side x: (+ x w w) y: y w: w h: h colour: col-2 strength: (col/e0 from: col-bm)))))
106
+        col-bm (texture.bitmap/value position: [(bmx.interp/value t: x)
107
+                                                (bmy.interp/value t: y)])
108
+        strength (col-bm.col/e0)
109
+        s 1
110
+        l (fn-l.interp/value t: (+ y (* (colour-offset.prng/value) colour-scale)))
111
+
112
+        col-1 (col/hsl h: (fn-h.interp/value t: (+ x (* (colour-offset.prng/value) colour-scale)))
113
+                       s l alpha)
114
+        col-2 (col/hsl h: (fn-h.interp/value t: (+ x w (* (colour-offset.prng/value) colour-scale)))
115
+                       s l alpha))
116
+      (left-side  x            y w h colour: col-1 strength)
117
+      (right-side x: (+ x w w) y w h colour: col-2 strength))))
124 118
 
125 119
 
126 120
 (fn (wash vol: 200
@@ -130,23 +124,24 @@
130 124
           seed: 272)
131 125
   (define
132 126
     w/3 (/ canvas/width 3)
133
-    h/3 (/ canvas/height 3))
127
+    h/3 (/ canvas/height 3)
128
+    tessellation line-segments)
134 129
   (loop (d from: -20 to: 1020 inc: 20)
135
-    (bezier tessellation: line-segments
136
-            line-width: line-width
137
-            coords: [[0            (wash-n x: 0            d: d seed: seed vol: vol)]
138
-                     [w/3          (wash-n x: w/3          d: d seed: seed vol: vol)]
139
-                     [(* w/3 2)    (wash-n x: (* w/3 2)    d: d seed: seed vol: vol)]
140
-                     [canvas/width (wash-n x: canvas/width d: d seed: seed vol: vol)]]
141
-            colour: colour)
142
-
143
-    (bezier tessellation: line-segments
144
-            line-width: line-width
145
-            coords: [[(wash-n x: 0             d: d seed: seed vol: vol) 0]
146
-                     [(wash-n x: h/3           d: d seed: seed vol: vol) h/3]
147
-                     [(wash-n x: (* h/3 2)     d: d seed: seed vol: vol) (* h/3 2)]
148
-                     [(wash-n x: canvas/height d: d seed: seed vol: vol) canvas/height]]
149
-            colour: colour)))
130
+    (bezier tessellation
131
+            line-width
132
+            coords: [[0            (wash-n x: 0            d seed vol)]
133
+                     [w/3          (wash-n x: w/3          d seed vol)]
134
+                     [(* w/3 2)    (wash-n x: (* w/3 2)    d seed vol)]
135
+                     [canvas/width (wash-n x: canvas/width d seed vol)]]
136
+            colour)
137
+
138
+    (bezier tessellation
139
+            line-width
140
+            coords: [[(wash-n x: 0             d seed vol) 0]
141
+                     [(wash-n x: h/3           d seed vol) h/3]
142
+                     [(wash-n x: (* h/3 2)     d seed vol) (* h/3 2)]
143
+                     [(wash-n x: canvas/height d seed vol) canvas/height]]
144
+            colour)))
150 145
 
151 146
 (fn (wash-n x: 0 d: 0 seed: 0 vol: 1)
152
-  (+ d (* vol (prng/perlin x: x y: d z: seed))))
147
+  (+ d (* vol (prng/perlin x y: d z: seed))))

+ 16
- 16
server/static/seni/sketch/1926-skull-face.seni View File

@@ -4,20 +4,20 @@
4 4
                          (address-of pass-1)])
5 5
 
6 6
 (each (per-pixel-func from: per-pixel-funcs)
7
-      (bitmap/each from: texture
8
-                   position: [500 500]
9
-                   width: 1000
10
-                   height: 1000
11
-                   shuffle-seed: 321
12
-                   fn: per-pixel-func))
7
+      (texture.bitmap/each position: [500 500]
8
+                           width: 1000
9
+                           height: 1000
10
+                           shuffle-seed: 321
11
+                           fn: per-pixel-func))
13 12
 
14 13
 (fn (pass-0 colour: (col/rgb r: 0 g: 0 b: 0 alpha: 0) position: [100 100])
15
-  (define a (col/e0 from: colour)
14
+  (define
15
+    a (colour.col/e0)
16 16
     angle (+ {6.37 (gen/stray from: 6.37 by: 2.00)} (* a math/PI)))
17
-  (line from: [(* {7.00 (gen/stray from: 7.00 by: 2.00)} (math/cos from: angle))
18
-               (* {12.00 (gen/stray from: 12.00 by: 2.00)} (math/sin from: angle))]
19
-        to: [(* {4.00 (gen/stray from: 4.00 by: 2.00)} (math/cos from: angle))
20
-             (* {-13.00 (gen/stray from: -13.00 by: 2.00)} (math/sin from: angle))]
17
+  (line from: [(* {7.00 (gen/stray from: 7.00 by: 2.00)} (angle.math/cos))
18
+               (* {12.00 (gen/stray from: 12.00 by: 2.00)} (angle.math/sin))]
19
+        to: [(* {4.00 (gen/stray from: 4.00 by: 2.00)} (angle.math/cos))
20
+             (* {-13.00 (gen/stray from: -13.00 by: 2.00)} (angle.math/sin))]
21 21
         width: (- {12.50 (gen/stray from: 12.50 by: 2.00)} a)
22 22
         brush: brush/d
23 23
         brush-subtype: 1
@@ -25,12 +25,12 @@
25 25
 
26 26
 (fn (pass-1 colour: (col/rgb r: 0 g: 0 b: 0 alpha: 0) position: [100 100])
27 27
   (define
28
-    b (col/e2 from: colour)
28
+    b (colour.col/e2)
29 29
     angle (+ {6.82 (gen/stray from: 6.82 by: 2)} (* b math/PI)))
30
-  (line from: [(* {14.00 (gen/stray from: 14.00 by: 2.00)} (math/cos from: angle))
31
-               (* {8.00 (gen/stray from: 8.00 by: 2.00)} (math/sin from: angle))]
32
-        to: [(* {10.00 (gen/stray from: 10.00 by: 2.00)} (math/cos from: angle))
33
-             (* {1.00 (gen/stray from: 1.00 by: 2.00)} (math/sin from: angle))]
30
+  (line from: [(* {14.00 (gen/stray from: 14.00 by: 2.00)} (angle.math/cos))
31
+               (* {8.00 (gen/stray from: 8.00 by: 2.00)} (angle.math/sin))]
32
+        to: [(* {10.00 (gen/stray from: 10.00 by: 2.00)} (angle.math/cos))
33
+             (* {1.00 (gen/stray from: 1.00 by: 2.00)} (angle.math/sin))]
34 34
         width: (- {2.40 (gen/stray from: 2.40 by: 2.00)} b)
35 35
         brush: brush/d
36 36
         brush-subtype: 1

Loading…
Cancel
Save