/g,">").replace(/"/g,""").replace(/'/g,"'")}let l={},c=[];function p(n,e,t){l={...l,dynamic:n,core:e,leinProject:t}}function d(){c=["wh","with-style"]}window.onload=()=>{let{dynamic:e,core:t,leinProject:r}=l;if(e&&(document.getElementById("code-dynamic").innerHTML=s(e)),t&&(document.getElementById("code-core").innerHTML=s(t)),r&&(document.getElementById("code-lein-project").innerHTML=s(r)),c){let n={wh:';; Copyright (c) 2016 Tyler Hobbs\n;; MIT License\n;; https://github.com/thobbs/genartlib/\n(defn h\n "Returns a given percentage of the height Quil-specific."\n ([] (h 1.0))\n ([percentage] (* (height) percentage)))\n\n;; Copyright (c) 2016 Tyler Hobbs\n;; MIT License\n;; https://github.com/thobbs/genartlib/\n(defn w\n "Returns a given percentage of the width. Quil-specific."\n ([] (w 1.0))\n ([percentage] (* (width) percentage)))\n',"with-style":"(defmacro with-style [& body]\n `(do\n (q/push-style)\n (try\n ~@body\n (finally (q/pop-style)))))\n"},e=c.map(e=>n[e]).join("\n");document.getElementById("code-helpers").innerHTML=s(e)}n(i).addPlugin((0,a.number)()),n(i).highlightAll()}}),a("2tEiH",function(n,t){e(n.exports,"number",()=>r);let r=n=>({"after:highlightElement":({el:n,result:e,text:t})=>{let r=e.value.split("\n");r.pop();let i=r.length.toString().length,o=r.map((n,e)=>{let t=(e+1).toString().padStart(i);return`${n}`}).join("\n");n.innerHTML=o}})}),o("d3dEA"),o("7Y8VX");var s=o("gUHNU");(0,s.make)("(ns sketch.dynamic\n (:require [artlib.quil.global :refer :all]\n [artlib.geometry.jts :refer [->points repair]]\n [genartlib.util :refer [w h]]\n [genartlib.random :refer [odds]]\n [genartlib.algebra :as galg]\n [quil.core :as q])\n (:import \n (org.locationtech.jts.triangulate VoronoiDiagramBuilder)\n (org.locationtech.jts.geom Coordinate GeometryFactory)))\n\n(let [factory (new GeometryFactory)\n points-atom (atom nil)]\n (defn draw [state]\n\n (let [frame (:frame state)\n f (/ frame 300)]\n\n (when (zero? frame)\n (q/background 0 0 0))\n\n (when (nil? @points-atom)\n (reset! points-atom (loop [points []]\n (let [[x y] [(gauss 0.5 0.03) (gauss 0.5 0.03)]\n n (gauss 0.5 0.03) #_(q/noise (* f 0.5) (* x 7) (* y 7))\n points (concat points (if (> 0.5 n) [[x y]] []))]\n (if (>= (count points) 900)\n points\n (recur points))))))\n (let [[points centroids polys] \n (loop [points @points-atom n (+ 1 (* f 60))]\n (let [voronoi-builder (doto \n (new VoronoiDiagramBuilder)\n (.setSites (map (fn [[x y]] (new Coordinate x y)) points)))\n diagram (.getDiagram voronoi-builder factory)\n geoms (->> (.getNumGeometries diagram)\n (range)\n (map #(.getGeometryN diagram %)))\n centroids (->> geoms\n (map #(.getCentroid %))\n (map (fn [point] [(.getX point) (.getY point)])))\n points (->> geoms\n (map #(.getUserData %))\n (map (fn [coord] [(.getX coord) (.getY coord)])))\n polys (map ->points geoms)\n new-points (map (fn [[px py] [cx cy]]\n (let [dir (galg/angle px py cx cy)\n dis (q/dist px py cx cy)\n amt 0.001]\n (if (> (abs (- dis amt)) 1e-2)\n [(+ px (* amt (Math/cos dir)))\n (+ py (* amt (Math/sin dir)))]\n [px py])))\n points centroids)\n new-points (filter (fn [[x y]]\n (and (> 1 x 0)\n (> 1 y 0)))\n new-points)]\n (with-style\n (q/no-fill)\n (q/stroke 0 1 (- 75 (* f 50)) 0.05)\n (q/stroke-weight (w 0.001))\n (doseq [[x y] points]\n (let [x (+ x 0.001)\n y (- y 0.002)]\n (dotimes [_ 10]\n (q/point (w (gauss x 0.01)) (h (gauss y 0.01)))))))\n (with-style\n (q/no-fill)\n (q/stroke 0 0 4 0.5)\n (q/stroke-weight (w 0.001))\n (doseq [[x y] points]\n (dotimes [_ 40]\n (q/point (w (gauss x 0.003)) (h (gauss y 0.001))))))\n\n (if (> n 0)\n (recur new-points (dec n))\n [new-points centroids polys])))]\n\n (println (count @points-atom))\n (reset! points-atom points)))))\n",'(ns sketch.core\n (:require [artlib.quil.middleware :refer [animation-mode]]\n [clojure.core.matrix :refer [set-current-implementation]]\n [quil.middleware :as qm]\n [sketch.dynamic :as dynamic]\n [quil.core :as q]))\n\n(set-current-implementation :vectorz)\n(println)\n\n(q/defsketch example\n :title "genuary-2025-04"\n :setup (fn [] {})\n :draw dynamic/draw\n :update identity\n :size [1080 1080]\n :animation {:render? true :dirname "4"}\n :middleware [qm/fun-mode animation-mode])\n\n','(defproject genuary-2025-01-04 "0.1.0-SNAPSHOT"\n :description "FIXME: write description"\n :url "https://example.com/FIXME"\n :license {:name "Apache License, Version 2.0"\n :url "https://www.apache.org/licenses/LICENSE-2.0.html"}\n :dependencies [[org.clojure/clojure "1.11.1"]\n [com.dedovic/artlib-core "0.0.10"]\n [com.dedovic/easings-clj "0.1.0"]\n [genartlib/genartlib "1.0.0"]\n [org.locationtech.jts/jts-core "1.18.1"]] ; utility functions\n :jvm-opts ["-Xms4000m" "-Xmx4000M" ; 4GB heap size\n "-server"\n "-Dsun.java2d.uiScale=1.0"] ; adjust scaling for high DPI displays\n :source-paths ["src/clj"]\n :java-source-paths ["src/java"]\n :resource-paths ["resources"])\n'),(0,s.withDefaultHelpers)();
dynamic.clj
core.clj
helpers
project.clj