
/g,">").replace(/"/g,""").replace(/'/g,"'")}let s={},c=[];function d(e,n,t){s={...s,dynamic:e,core:n,leinProject:t}}function m(){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 (:import [java.awt Color])\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 :as color]\n [artlib.quil.global :refer :all]\n [genartlib.util :refer [w h]]\n [quil.core :as q]))\n\n(def palette color/d)\n\n(defn rgb->hsb [r g b]\n (let [hsb-array (Color/RGBtoHSB (int r) (int g) (int b) nil)\n hue (* 360 (aget hsb-array 0))\n sat (* 100 (aget hsb-array 1))\n bri (* 100 (aget hsb-array 2))]\n [hue sat bri]))\n\n(defn get-col [t]\n (let [[r g b] (palette t)]\n (rgb->hsb (* r 255) (* g 255) (* b 255))))\n\n(defn draw [state]\n (when (zero? (:frame state))\n (q/background 300 10 8))\n\n (let [frame (:frame state)\n f (/ frame 300)\n pad 0.05\n num-columns 7\n num-ys (+ 5 (int (* 10 f)))\n rez 5.1\n drawing-size (- 1 pad pad)\n column-width (/ drawing-size num-columns)\n y-step (/ drawing-size num-ys)]\n\n (doseq [[idx x] (map-indexed vector (range pad (- 1 pad 1e-5) column-width))]\n (let [content-width-rel 0.9\n content-width-abs (* content-width-rel column-width)\n content-pad-abs (* 1/2 (- column-width content-width-abs))\n x0 (+ x content-pad-abs)\n x1 (+ x0 content-width-abs)\n\n color-xt (* (/ idx num-columns) 1.9)]\n\n (doseq [[idx y] (map-indexed vector (range pad (- 1 pad 1e-5 (- y-step)) y-step))]\n (let [scale 0.15\n s2 13\n x-amt (+ x (* 0.1 (Math/cos (* f Math/PI 2))))\n y-amt (+ y (* 0.1 (Math/sin (* f Math/PI 2))))\n\n n (q/noise (* x-amt rez) (* y-amt rez) (* 0.2 (Math/cos (* f Math/PI 2))))\n n (- (mod (* n 13) (gauss 1.5 0.1)) 0.75)\n y0 (+ y (* scale n))\n\n n (q/noise (* x-amt rez) (* y-amt rez) (* 0.2 (Math/cos (* f Math/PI 2))))\n n (- (mod (* n 13) (gauss 1.5 0.1)) 0.75)\n y1 (+ y (* scale n))\n \n num-points (/ 10000 (* num-columns num-ys))\n \n color-yt (* (/ idx num-ys) 3)\n color-t (mod (+ color-xt color-yt) 1.0)\n [hue sat bri] (get-col (mod color-t 1.0))\n sat (* sat 0.7)]\n\n (dotimes [n num-points]\n (let [t (rand)\n x (q/lerp x0 x1 t)\n y (q/lerp y0 y1 t)\n\n shift (/ (int (* f 7)) 5)\n n (q/noise (+ shift x) y (rand))\n t (mod (* n 3) 1.0)\n x (q/lerp x0 x1 t)\n y (q/lerp y0 y1 t)]\n (with-style\n (q/stroke hue sat bri 0.2)\n (q/point (w x) (h y)))))))))\n\n (with-style\n (q/fill 300 10 8)\n (q/rect (w 0) (h 0) (w 1) (h pad))\n (q/rect (w 0) (h (- 1 pad)) (w 1) (h pad)))))\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-16"\n :setup (fn [] {})\n :draw dynamic/draw\n :update identity\n :size [1080 1080]\n :animation {:render? false :dirname "color"}\n :middleware [qm/fun-mode animation-mode])\n\n','(defproject genuary-2024-16 "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 "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,o.withDefaultHelpers)();
dynamic.clj
core.clj
helpers
project.clj