This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-17
Channels
- # announcements (7)
- # architecture (12)
- # babashka (5)
- # bangalore-clj (4)
- # beginners (70)
- # biff (23)
- # calva (21)
- # clojure (130)
- # clojure-bay-area (3)
- # clojure-berlin (1)
- # clojure-brasil (1)
- # clojure-europe (55)
- # clojure-finland (4)
- # clojure-greece (5)
- # clojure-nl (3)
- # clojure-norway (10)
- # clojurescript (52)
- # code-reviews (4)
- # community-development (1)
- # data-science (7)
- # datahike (6)
- # datomic (1)
- # events (1)
- # figwheel-main (7)
- # fulcro (23)
- # helix (2)
- # honeysql (32)
- # malli (18)
- # membrane (6)
- # nbb (22)
- # nyc (1)
- # off-topic (26)
- # pathom (2)
- # polylith (34)
- # quil (13)
- # releases (1)
- # remote-jobs (4)
- # scittle (1)
- # shadow-cljs (52)
- # sql (24)
- # tools-deps (17)
- # vim (11)
- # web-security (15)
- # xtdb (6)
hi, how do I add some randomness/noise to a black horizontal line for example? To make it look less artificial?
Hi, perhaps a stupid question, but I'm stumped. How can I "wrap around" the animation here? (I mean how do I make it look like it's a infinite strip scrolling right?)
(ns depata_lanuwa
(:require [quil.core :as q]
[quil.helpers.drawing :refer [line-join-points]]
[quil.helpers.seqs :refer [range-incl]]))
(defn rand-walk-coords
[seed]
(lazy-seq (cons seed (rand-walk-coords (+ seed (/ (- (rand 5) 1) 20))))))
(defn slightly-natural-horizontal-line
[x-start x-end y]
(let [step 2
xs (range-incl x-start x-end step)
ys (rand-walk-coords y)
line-args (line-join-points xs ys)]
(dorun (map #(apply q/line %) line-args))))
(defn slightly-natural-vertical-line
[y-start y-end x]
(let [step 2
ys (range-incl y-start y-end step)
xs (rand-walk-coords x)
line-args (line-join-points xs ys)]
(dorun (map #(apply q/line %) line-args))))
(defn n-natural-horizontal-lines
[x-start x-end y-start n y-dist]
(doseq [y
(->> (range-incl n)
(map (comp (partial + y-start) (partial * y-dist))))]
(slightly-natural-horizontal-line x-start x-end y)))
(defn n-natural-vertical-lines
[y-start y-end x-start n x-dist]
(doseq [x
(->> (range-incl n)
(map (comp (partial + x-start) (partial * x-dist))))]
(slightly-natural-vertical-line y-start y-end x)))
(defn single-block [weight stroke x n d]
(q/stroke-weight weight)
(q/smooth 8)
(apply q/stroke stroke)
(let [nd (* n d)]
(n-natural-horizontal-lines x (+ x nd) 10 n d)
(n-natural-vertical-lines 10 (+ 10 nd) (+ x nd) n d)
(n-natural-vertical-lines (+ 10 nd) (+ 10 (* 2 nd)) x n d)
(n-natural-horizontal-lines (+ x nd) (+ x (* 2 nd)) (+ 10 nd) n d))
)
(def x-offset (atom 0))
(reset! x-offset 0)
(defn draw []
(q/background 255)
(q/stroke 0 0 0)
; Top border
(q/stroke-weight 3)
(q/stroke 0 0 0)
(q/line [0 10] [600 10])
; Bottom border
(q/stroke-weight 3)
(q/stroke 0 0 0)
(q/line [0 110] [600 110])
(q/frame-rate 30)
(doseq [x (range-incl 0 500 100)]
(single-block 1 [0 0 0] (+ @x-offset x) 5 10))
(swap! x-offset inc)
)
(q/defsketch depata_lanuwa
:title ""
:settings #(q/smooth 2)
;;:setup draw
:draw draw
:size [600 120])
I think I used imagemagick myself
I’ve pondered whether there are easier solutions. For just recording a .mov video, I use Quicktime Player on Mac, it has a great screen recorder where you can select part of the screen. And no install - it comes with the OS 🙂 I wonder if there’s some good .mov->gif tool. Maybe imagemagick can do it.
Ah, well 🙂
I think I’m confusing imagemagick and ffmpeg
For the best quality and infinite loops ImageMagicks's convert
with saved individual frames is the option I use most. Saving to .mov adds another lossy compression step.
Thanks for the tip!