-
-
Save triss/1a83c8f130f0003a337c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns pictures.core | |
(:use mikera.image.colours) | |
(:use mikera.image.core) | |
(:use mikera.image.filters) | |
(:use mikera.image.spectrum) | |
(:require [clojure.java.io :refer [resource]])) | |
(def width 1280) | |
(def height 600) | |
(def image (new-image width height)) | |
(def pixels (get-pixels image)) | |
(defn abssin [x] (Math/abs (Math/sin (* Math/PI 3 x)))) | |
(defn pic [x y] | |
(let [v (abssin (* x y))] | |
(rgb (/ x 2) (abssin (* y v 2)) v))) | |
(dotimes [i (* width height)] | |
(let [x (/ (mod i width) width) | |
y (/ (/ i width) height)] | |
(aset pixels i (pic x y)))) | |
(set-pixels image pixels) | |
(show image) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment