OnPatterns

ThoughtStorms Wiki

Not "design patterns" but other interesting pattern related stuff

Patterning is my library for creating pretty visual patterns.


(defn rcol []
   {:stroke 
   (rand-nth [
     (p-color 127 255 127)
     (p-color 255 )
     (p-color 200 100 200)
     (p-color 200 200 100)

     (p-color 102 255 178)
     (p-color  255 51 255)  ; pink
     (p-color 0 204 204)
     (p-color  255 51 51)
     (p-color   255 255 204   )

   ])
   :stroke-weight 2
   }
)

(defn dark-fill [style]
 (conj style {:fill (darker-color (:stroke style))})
)

(defn t1
   ([p] (t1 p (rcol))) 
   ([p s]
      (->> p
        (stack
          (drunk-line 10 0.2 s)
        )
        four-round
        (rotate (/ (rand-int 10) 10))
     )
   ) 
)

(stack
   (rect -1 -1 2 2 {:fill (p-color 0)})

   (grid-layout 5 
     (repeat (t1 []  {:stroke (p-color 250 180 200)
                            :stroke-weight 2}))
   ) 

   (->>
   (apply stack 
      (take 3
        (iterate t1 (drunk-line 10 0.1 (rcol)))
      ))
    four-mirror
   )
)