/g,">").replace(/"/g,""").replace(/'/g,"'")}let o={},c=[];function d(e,n,t){o={...o,dynamic:e,core:n,leinProject:t}}function p(){c=["wh","with-style"]}window.onload=()=>{let{dynamic:n,core:t,leinProject:i}=o;if(n&&(document.getElementById("code-dynamic").innerHTML=s(n)),t&&(document.getElementById("code-core").innerHTML=s(t)),i&&(document.getElementById("code-lein-project").innerHTML=s(i)),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=s(n)}e(a).addPlugin((0,l.number)()),e(a).highlightAll()}}),l("2tEiH",function(e,t){n(e.exports,"number",()=>i);let i=e=>({"after:highlightElement":({el:e,result:n,text:t})=>{let i=n.value.split("\n");i.pop();let a=i.length.toString().length,r=i.map((e,n)=>{let t=(n+1).toString().padStart(a);return`${e}`}).join("\n");e.innerHTML=r}})}),r("d3dEA"),r("7Y8VX");var s=r("gUHNU");(0,s.make)("(ns sketch.dynamic\n (:require ; [clojure.java.shell :refer [sh]]\n [easings.core :as ease]\n [artlib.geometry.jts :as jts]\n [artlib.quil.global :refer :all]\n [artlib.color.dictionary :as colord]\n [genartlib.util :refer [w h]]\n [quil.core :as q]))\n\n(defn \n dist-p\n [[ax ay] [bx by]]\n (q/dist ax ay bx by))\n\n(defn\n lerp-p\n [[ax ay] [bx by] t]\n [(q/lerp ax bx t) (q/lerp ay by t)])\n\n(defn \n dims\n [rect]\n (let [[a _ b _] rect\n [ax ay] a\n [bx by] b]\n [(abs (- bx ax)) (abs (- by ay))]))\n\n(let [color-dictionary (colord/init)\n palette (cycle (colord/get-combination-hsb color-dictionary :294))]\n (defn draw [state]\n (q/background 0 0 100)\n\n (let [frame (:frame state)\n f (/ frame 300)\n quad [[0.01 0.01] [0.99 0.01] [0.99 0.99] [0.01 0.99]]\n iters 4\n quads (loop [quads [quad] n iters]\n (let [q (/ n iters)\n buffer-amt (+ -0.002 (* (ease/ease-in-out-sine q) 0.001))\n new-quads (->> quads \n (mapcat (fn [quad]\n (let [[cx cy] (jts/centroid quad)\n n (q/noise (* cx 2.31) (* cy 3.01) (* f 0.25))\n\n ;; cycle the points inside the quad so that the \n ;; longest side is index 0 and 2. This makes \n ;; it easier to subdivide the longest side \n ;; since now it is always the first side.\n ;;\n ;; also assumes quad is properly wound, i.e.\n ;; points are spaced clockwise or anticlockwise.\n [dist-a dist-b] (->> quad\n (partition 2 1)\n (take 2)\n (map #(apply dist-p %)))\n offset (if (> dist-a dist-b) 0 1)\n [a b c d] (take 4 (drop offset (cycle quad)))\n ab (lerp-p a b n)\n dc (lerp-p d c n)]\n [[a ab dc d]\n [ab b c dc]])))\n (map #(jts/buffer-poly % buffer-amt)))]\n (if (zero? n)\n new-quads\n (recur new-quads (dec n)))))\n\n quads (->> quads\n (map #(with-meta % {:origin % :level 0}))\n (iterate (fn [quads]\n (->> quads\n (map #(let [{origin :origin level :level} (meta %)]\n (with-meta \n (jts/buffer-poly % -0.003) \n {:origin origin :level (inc level)})))\n (filter (complement empty?))\n (filter #(> (apply min (dims %)) 0.003)))))\n (take 20)\n (apply concat))]\n\n (doseq [quad quads]\n (let [{origin :origin level :level} (meta quad)\n [cx cy] (jts/centroid origin)\n n (q/noise (* cx 5) (* cy 5))\n idx (* n 15)\n offset (if (even? level) 0 1)\n color-a (first (drop (+ idx offset) palette))]\n (with-style\n (apply q/fill color-a)\n (q/begin-shape)\n (doseq [[x y] quad]\n (q/vertex (w x) (h y)))\n (q/end-shape :close)))))))\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-01-12"\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-12 "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.11"]\n [com.dedovic/easings-clj "0.1.0"]\n [genartlib/genartlib "1.0.0"]] ; 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