Skip to content

Instantly share code, notes, and snippets.

View slawo-ch's full-sized avatar

Slawomir Chodnicki slawo-ch

  • Twineworks GmbH
  • Berlin, Germany
View GitHub Profile
@slawo-ch
slawo-ch / _description.md
Created December 16, 2020 11:56 — forked from ww9/one-line-text-art-and-emojis_utf8_ascii.txt
Emojis, UTF8, ASCII (one line) #misc

Collection of one line text art (◕‿◕✿)

Collection of emojis and one line text art like (╯°□°)╯︵ ┻━┻ 🤗

// 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
// 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;
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;
// 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(
const tick = time => {
moveHeightMaps(time);
updateImageData();
c.putImageData(image, 0, 0);
requestAnimationFrame(tick);
};
requestAnimationFrame(tick);
// 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
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;
// 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++) {
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";