Skip to content

Instantly share code, notes, and snippets.

View khoparzi's full-sized avatar
💭
Instigating Creativity

khoparzi

💭
Instigating Creativity
View GitHub Profile
@khoparzi
khoparzi / Juliana-2020.js
Last active September 28, 2021 18:11
Almost a month's worth of Marching.js sketches exploring various experiments with Julia fractals through the month of July 2020. Marching.js is a JavaScript shader compiler specifically focused on ray marching via signed distance functions.
// Try these at https://charlieroberts.github.io/marching/playground/
// 1 Jul
march(
mb = Julia()
.material(Material('phong', Vec3(.0), Vec3(.5), Vec3(1), 32, Vec3(0))),
Plane(Vec3(0, 0, 1), 0.5).material('white glow')
)
.fog( .2, Vec3(0.25, 0.3, 0) )
@khoparzi
khoparzi / GitHub-Universe-2020.tidal
Created December 1, 2020 03:34
Code from a live-coded performance at GitHub Universe Dec 2020 with @samarthgulati
d1
-- $ dubd
-- $ stb 0.3 (chunk 8 (fast 2))
-- $ slow 8 $ chop 16
-- $ smash 8 [2,8,7,2]
-- $ fast 2
$ s "pads" # n 3 # l 1 -- Peace is the mission
-- $ s "pads" # n 20 # l 1 -- Intense pads
-- $ s "pads" # n 21 # l 1 -- Elevate
-- $ basspad # l 1
@khoparzi
khoparzi / GitHub-Satellite-India-March-2021.tidal
Last active October 2, 2024 13:03
Code from a live-coded performance at GitHub Satellite Mar 2020 with @samarthgulati
-- _______ __ __ _______ __ _______ __ __ __ __ __
-- | __|__| |_| | |.--.--.| |--. | __|.---.-.| |_.-----.| | |__| |_.-----.
-- | | | | _| || | || _ | |__ || _ || _| -__|| | | | _| -__|
-- |_______|__|____|___|___||_____||_____| |_______||___._||____|_____||__|__|__|____|_____|
------------------------------------------------------------------------------
-- HARMONIUM
d1
-- $ degradeBy 0.2
@khoparzi
khoparzi / Marching-2021.js
Created March 30, 2021 19:41
Almost a month's worth of Marching.js sketches exploring various experiments with Signed Distance Fields and combinatorial geometries through the month of March 2021. [Marching.js](https://charlieroberts.github.io/marching/playground/) is a JavaScript shader compiler specifically focused on ray marching via signed distance functions.
// 1 Mar 2021
// Alright time for a new 30 day series! I present to you a new round of Marching.js
m = march(
u = Union2(
hl1 = Halve(Onion(Sphere(3), 0.012), Halve.UP),
hl2 = Halve(Onion(Sphere(2), 0.012), Halve.UP),
hl3 = Halve(Onion(Sphere(1), 0.012), Halve.UP),
hl4 = Halve(Onion(Sphere(0.5), 0.012), Halve.UP),
@khoparzi
khoparzi / jArm-Tidal-Functions-In.js
Created April 9, 2021 07:58
Continuous modulation and functions from Tidal implemented in JS (for using in Hydra or P5)
sin = ({time}) => Math.sin(time) // sin
sq = ({time}) => ((Math.sin(time) < 0) ? 0 : 1) // square
saw = ({time}) => (time % 1) * 2 - 1 // saw
sinf = (freq) => ({time}) => Math.sin(time*freq) // sin at freq
sqf = freq => ({time}) => ((Math.sin(time*freq) < 0) ? 0 : 1) // square at freq
sawf = (freq) => ({time}) => ((time * freq) % 1) * 2 - 1 // saw at freq
rsinf = (min,max,freq) => ({time}) => Math.sin(time*freq) * max + min // ranged sin at freq
rsqf = (min,max,freq) => ({time}) => ((Math.sin(time*freq) < 0) ? 0 : 1) * max + min // ranged square at freq