
/g,">").replace(/"/g,""").replace(/'/g,"'")}let s={},c=[];function u(e,n,t){s={...s,dynamic:e,core:n,leinProject:t}}function d(){c=["wh","with-style"]}window.onload=()=>{let{dynamic:n,core:t,leinProject:r}=s;if(n&&(document.getElementById("code-dynamic").innerHTML=o(n)),t&&(document.getElementById("code-core").innerHTML=o(t)),r&&(document.getElementById("code-lein-project").innerHTML=o(r)),c){let e={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"},n=c.map(n=>e[n]).join("\n");document.getElementById("code-helpers").innerHTML=o(n)}e(a).addPlugin((0,l.number)()),e(a).highlightAll()}}),l("3PmhV",function(e,t){n(e.exports,"number",()=>r);let r=e=>({"after:highlightElement":({el:e,result:n,text:t})=>{let r=n.value.split("\n");r.pop();let a=r.length.toString().length,i=r.map((e,n)=>{let t=(n+1).toString().padStart(a);return`${e}`}).join("\n");e.innerHTML=i}})}),i("d3dEA"),i("7Y8VX");var o=i("dZ8Um");(0,o.make)('(ns sketch.dynamic\n (:require ; [clojure.java.shell :refer [sh]]\n ; [genartlib.algebra :refer :all]\n ; [genartlib.curves :refer :all]\n ; [genartlib.geometry :refer :all]\n ; [genartlib.random :refer :all]\n ; [kdtree :as kd]\n [artlib.color.palettes :refer [e]]\n [clojure.core.matrix :as matrix]\n [artlib.quil.global :refer :all]\n [genartlib.util :refer [w h]]\n [quil.core :as q]))\n(defn gauss\n "Samples a single value from a Gaussian distribution with the given mean\n and variance"\n [mean variance]\n (+ mean (* variance (q/random-gaussian))))\n\n(defn random-point-in-rect [p1 p2 p3]\n "Generate a random point in the rectangle formed by the three points p1 p2 p3."\n (let [ a (matrix/sub p2 p1)\n b (matrix/sub p3 p1)\n u1 (rand)\n u2 (rand)\n ;; this will reflect and treat [p1 p2 p3] as a triangle\n ;; [u1 u2] (if (> (+ u1 u2) 1)\n ;; (let [u1 (- 1 u1)\n ;; u2 (- 1 u2)]\n ;; [u1 u2])\n ;; [u1 u2])\n w (matrix/add (matrix/mul a u1) (matrix/mul b u2))\n p (matrix/add p1 w)]\n p))\n\n(defn draw-actual [state]\n (let [frame (:frame state)\n f (/ frame 300)\n rect-w (+ 0.1 (* f 0.5))\n rect-h 0.05\n x0 (/ (- 1 rect-w) 2)\n y0 0.45\n y0 (+ y0 (/ (- 1 rect-h) 2))\n n 35]\n\n (with-style\n (q/no-stroke)\n (q/fill 0 0 10 0.5)\n (q/rect (w 0.01) (h 0.01) (w 0.98) (h 0.98)))\n\n (with-style\n (q/stroke 0 0 50 0.1)\n (q/stroke-weight (w 0.002))\n (q/no-fill)\n (let [margin 0.15\n size (- 1 (* 2 margin))]\n (dotimes [n 25]\n (with-matrix\n (q/translate (w (gauss 0 0.005)) (h (gauss 0 0.005)))\n (q/rect (w margin) (h margin) (w size) (h size) (w 0.001) (w 0.1) (w 0.001) (w 0.1))))))\n\n (with-style\n (q/stroke 0 0 100 0.09)\n (q/stroke-weight (w 0.001))\n (q/no-fill)\n (dotimes [n (* n 2000)]\n (let [[x y] (random-point-in-rect \n [x0 y0] \n [(+ x0 rect-w) y0] \n [x0 (+ y0 rect-h)])]\n (q/point (w (* x 1.3)) (h (- 1 y)))\n (q/point (w (- (* x 1.3) 0.3)) (h y)))))\n\n (with-style\n (q/stroke 180 100 100 0.15)\n (q/stroke-weight (w 0.001))\n (q/no-fill)\n (dotimes [n (* n 2000)]\n (let [f2 (+ 0.1 (* f 0.2))\n y0 (+ y0 -0.1)\n [x y] (random-point-in-rect \n [(+ f2 rect-w) (+ y0 rect-h)] \n [(+ f2 rect-w -0.15 f2) (+ y0 rect-h)]\n [(+ f2 rect-w) (+ y0 rect-h -0.9 f2)])]\n (q/point (w x) (h y))\n (q/point (w (- 1 x)) (h y))\n )))\n ))\n\n(defn draw [state]\n (q/background 0 0 10)\n\n (let [frame (:frame state)\n f (/ frame 300) \n gr (q/create-graphics (w 1) (h 1))]\n (q/with-graphics gr\n (q/color-mode :hsb 360 100 100 1.0)\n (draw-actual state))\n\n (let [times 4\n step (/ 1 times)]\n (doseq [n (range 0 (+ 1 step) step)]\n (let [n (- 1 n)\n x (+ 0 (/ (- 1 n) 2))\n y (+ 0 (/ (- 1 n) 2))]\n (q/image gr (w x) (h y) (w n) (h n)))))))\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-2024-03"\n :setup (fn [] {})\n :draw dynamic/draw\n :update identity\n :size [1080 1080]\n :animation {:render? true :dirname "1"}\n :middleware [qm/fun-mode animation-mode])\n\n','(defproject genuary-2024-03 "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.8"]\n [genartlib/genartlib "0.1.21"]] ; 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 :aot :all)\n'),(0,o.withDefaultHelpers)();
dynamic.clj
core.clj
helpers
project.clj