Hei

Mathieu @p01 Henri

DEMOSCENE

CREATIVE CODING

DATA VISUALISATION

ART×JS

ART×JS

CREATIVE MINDSET Abusing the standards + Visual understanding of mathematics

// 10 PRINT
<html onmousemove=innerHTML+="​╱╲"[event.pageX%3]>

ZERO FRAMEWORKS AND LIBRARIES

ONE PRIMITIVE AND ONE FORMULA

Dirty trigonometry

IEEE 754

.2 + .1
// 0.30000000000000004
for (i = 0; i < 10; i += .1) {
}
// i = 10.09999999999998
for (i = 0; i < 10; i += 1/8) {    
}
// i = 10
text = '';
for (i = 0; i < 5; i += 1/8)
  text +=
    i % 1 ? Math.floor(i)
    : '\n';
b.textContent = text;

COLORS

ctx.fillStyle = `hsl(${time},13%, 37%)`
third = Math.PI * 2 / 3;
ctx.fillStyle = 'rgb('+ [
    127 + 127 * Math.cos(time - third),
    127 + 127 * Math.cos(time),
    127 + 127 * Math.cos(time + third)
] +')';

MOTION BLUR

// Don't clear the screen completly
ctx.fillStyle = 'rgba(0, 0, 0, .1)';
ctx.fillRect(0, 0, width, height);
// .. before doing your visuals

GLOW

// CSS
background: pink;
box-shadow: 0 0 10vmin hotpink;
// Canvas
ctx.fillStyle = 'pink';
ctx.shadowColor = 'hotpink';
ctx.shadowBlur = 16;
ctx.fillRect(50, 50, 100, 100);

MUSIC

Audio element or Web Audio Api

// Audio element + WAVE PCM
h = d = 'data:audio/wav;base64,' +
    'UklGRiQAAABXQVZFZm10IBAAAAABAAEAwF0AAMBdAAABAAgAZGF0YQAA';
for (t = 0; t++ < 8e5;)
  d += String.fromCharCode(/* ByteBeat */);
Z = new Audio(h + btoa(d));
Z.play();
// Audio API + script processor
A = new AudioContext;
S = A.createScriptProcessor(L = 1024, T = 0, 1);
S.connect(A.destination);
S.onaudioprocess = e => {
  for (i = 0; i < L; i++)
    e.outputBuffer.getChannelData(0)[i] = /* ByteBeat */
};
// Hihat
osc = Math.random() * 2 - 1;
env = Math.pow(1 - positionInNote, 8);
vol = 1;
sample = osc * env * vol;

RENDER LOOP

update = now => {
  requestAnimationFrame(update);
  // Visuals
};
// Let's start
update();
// Two birds one stone
scriptNode.onaudioprocess = e => {
  // Visuals & Audio
}

CREATIVE MINDSET Abusing the standards + Visual understanding of mathematics

ART×JS

F#!K IT WE'LL DO IT LIVE

~

Why?

Fun Rewarding Structure Focus

Thanks FFconf Questions → @p01 #codevember