
/g,">").replace(/"/g,""").replace(/'/g,"'")}let o={},c=[];function d(n,e,t){o={...o,dynamic:n,core:e,leinProject:t}}function h(){c=["wh","with-style"]}window.onload=()=>{let{dynamic:e,core:t,leinProject:a}=o;if(e&&(document.getElementById("code-dynamic").innerHTML=l(e)),t&&(document.getElementById("code-core").innerHTML=l(t)),a&&(document.getElementById("code-lein-project").innerHTML=l(a)),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=l(e)}n(r).addPlugin((0,s.number)()),n(r).highlightAll()}}),s("3PmhV",function(n,t){e(n.exports,"number",()=>a);let a=n=>({"after:highlightElement":({el:n,result:e,text:t})=>{let a=e.value.split("\n");a.pop();let r=a.length.toString().length,i=a.map((n,e)=>{let t=(e+1).toString().padStart(r);return`${n}`}).join("\n");n.innerHTML=i}})}),i("d3dEA"),i("7Y8VX");var l=i("dZ8Um");(0,l.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.quil.global :refer :all]\n [genartlib.util :refer [w h]]\n [quil.core :as q]))\n\n(defn walk-to [[ax ay] [bx by] n f]\n (let [d (q/dist ax ay bx by)\n step (/ d n)\n points (iterate (fn [[x y]]\n (let [theta (point-angle [x y] [bx by])\n theta (gauss theta 0.25)\n x (+ x (* step (Math/cos theta)))\n y (+ y (* step (Math/sin theta)))]\n [x y]))\n [ax ay])]\n (take n points)))\n\n\n(defn make-arc [[cx cy] [ax ay] [bx by] n f]\n (let [r (q/dist cx cy ax ay)\n theta0 (point-angle [cx cy] [ax ay])\n theta-end (point-angle [cx cy] [bx by])\n points-from-center (walk-to [cx cy] [ax ay] 5 f)\n points-to-center (reverse (walk-to [cx cy] [bx by] 5 f))\n points (map (fn [theta]\n (let [x (+ 0.5 (* r (Math/cos theta)))\n y (+ 0.5 (* r (Math/sin theta)))]\n [x y]))\n (range theta0 theta-end (/ (- theta-end theta0) n)))]\n (concat points-from-center points points-to-center)))\n\n(def mask (atom nil))\n(def lines (atom nil))\n\n(defn draw [state]\n (q/color-mode :rgb 255 255 255 255)\n (q/background 255)\n\n (let [frame (:frame state)\n f (/ frame 300)\n r 0.41\n n 5\n num-lines 150\n c-std 0.03\n\n f (* f 0.01)\n f2 (* 0.01 (Math/cos (* f Math/PI 2)))\n reverse-mod (fn [div n] (mod n div))\n points (->> (mod (* (q/noise (* 0.3 (Math/sin (* f Math/PI 4)))) Math/PI 8) (* Math/PI 1))\n (iterate #(+ % (* (q/noise (* 2.1 f2) (* f 9.3)) Math/PI 1.9)))\n (take n)\n (map #(mod % (* Math/PI 2)))\n (sort)\n (map #(let [x (+ 0.5 (* r (Math/cos %))) \n y (+ 0.5 (* r (Math/sin %)))]\n [x y])))\n triangles (->> points\n (partition 2 1)\n (map #(concat % [[(gauss 0.5 c-std) (gauss 0.5 c-std)]])))]\n (doseq [[idx tri] (map-indexed vector triangles)]\n (reset! mask (q/create-graphics (w) (h)))\n (reset! lines (q/create-graphics (w) (h)))\n\n ;; mask\n (q/with-graphics @mask\n (q/background 255 255 255 0)\n (q/no-stroke)\n (q/fill 0 0 0 255)\n (q/begin-shape)\n (let [[a b c] tri\n points (make-arc c b a 50 f)]\n (doseq [[x y] points]\n (q/vertex (w x) (h y))))\n (q/end-shape))\n\n ;; lines\n (q/with-graphics @lines\n (q/background 255 255 255 0)\n (q/stroke-weight (w (/ 1 num-lines 25)))\n (q/stroke 0 0 0 255)\n (q/no-fill)\n (with-matrix\n (q/translate (w 0.5) (h 0.5))\n (q/rotate (* (rand) Math/PI))\n (q/translate (w -0.5) (h -0.5))\n (dotimes [n num-lines]\n (let [n (/ n num-lines)]\n (q/line (w n) (h 0) (w n) (h 1))))\n\n (when (> idx 2)\n (q/translate (w 0.5) (h 0.5))\n (q/rotate (* (rand) Math/PI 2))\n (q/translate (w -0.5) (h -0.5))\n (dotimes [n num-lines]\n (let [n (/ n num-lines)]\n (q/line (w n) (h 0) (w n) (h 1)))))\n ))\n\n (q/mask-image @lines @mask)\n (q/image @lines 0 0))))\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-05"\n :setup (fn [] {})\n :draw dynamic/draw\n :update identity\n :size [4000 4000]\n :animation {:render? true :dirname "1"}\n :middleware [qm/fun-mode animation-mode])\n\n','(defproject genuary-2024-05 "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 [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,l.withDefaultHelpers)();
dynamic.clj
core.clj
helpers
project.clj