Collection of emojis and one line text art like (╯°□°)╯︵ ┻━┻ 🤗
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
// stores whether we're interpolating colors | |
// from palette 0 -> 1 (1) or 1 -> 0 (-1) | |
let prevDirection = 1; | |
const updatePalette = t => { | |
const timeScale = 0.0005; | |
const x = t * timeScale; | |
// normalized value 0..1 used to interpolate palette colors |
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
// stores whether we're interpolating colors | |
// from palette 0 -> 1 (1) or 1 -> 0 (-1) | |
let prevDirection = 1; | |
const updatePalette = t => { | |
const timeScale = 0.0005; | |
const x = t * timeScale; | |
// normalized value 0..1 used to interpolate palette colors | |
const inter = (Math.cos(x) + 1) / 2; |
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
const makeFiveColorGradient = (c1, c2, c3, c4, c5) => { | |
const g = []; | |
for (let i = 0; i < 64; i++) { | |
const f = i / 64; | |
g[i] = interpolate(c1, c2, f); | |
} | |
for (let i = 64; i < 128; i++) { | |
const f = (i - 64) / 64; |
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
// offsets for moving height maps | |
let dx1 = 0; | |
let dy1 = 0; | |
let dx2 = 0; | |
let dy2 = 0; | |
// adjust height maps offsets | |
const moveHeightMaps = t => { | |
dx1 = Math.floor( |
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
const tick = time => { | |
moveHeightMaps(time); | |
updateImageData(); | |
c.putImageData(image, 0, 0); | |
requestAnimationFrame(tick); | |
}; | |
requestAnimationFrame(tick); |
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
// offsets for height maps | |
// for now, we leave them at upper left corner | |
let dx1 = 0; | |
let dy1 = 0; | |
let dx2 = 0; | |
let dy2 = 0; | |
// update our image data array with greyscale values |
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
const heightMap2 = []; | |
for (let u = 0; u < mapSize; u++) { | |
for (let v = 0; v < mapSize; v++) { | |
const i = u * mapSize + v; | |
const cx = u - mapSize / 2; | |
const cy = v - mapSize / 2; | |
// skewed distance as input to chaos field calculation, | |
// scaled for smoothness over map distance | |
const d1 = distance(0.8 * cx, 1.3 * cy) * 0.022; |
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
// size of our height maps | |
const mapSize = 1024; | |
// returns the distance of point x,y from the origin 0,0 | |
const distance = (x, y) => Math.sqrt(x * x + y * y); | |
// init height map 1 | |
const heightMap1 = []; | |
for (let u = 0; u < mapSize; u++) { | |
for (let v = 0; v < mapSize; v++) { |
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
const crawl = document.getElementById("crawl"); | |
const crawlContent = document.getElementById("crawl-content"); | |
const crawlContentStyle = crawlContent.style; | |
// start crawl at bottom of 3d plane | |
let crawlPos = crawl.clientHeight; | |
const moveCrawl = distance => { | |
crawlPos -= distance; | |
crawlContentStyle.top = crawlPos + "px"; |
NewerOlder