Hello JSConf
Code golfing & Creative coding
.2 + .1
// 0.30000000000000004
for (i = 0; i < 10; i += .1) {
}
// i = 10.09999999999998
for (i = 0; i < 10; i += 1/8) {
}
// i = 10
Regular 1k and 4k demos pre-generate the music.
h=d='data:audio/wav;base64,'+
'UklGRiQAAABXQVZFZm10IBAAAAABAAEAwF0AAMBdAAABAAgAZGF0YQAA';
for(t=0;t++<8e5;)
d+=String.fromCharCode(/* ByteBeat */);
Z=new Audio(h+btoa(d));
Z.play();
var inst = Math.random() - .5;
inst *= Math.pow(1 - (T % 1), 8);
d += String.fromCharCode(inst * volume + 127);
ctx.fillStyle = 'hsl(31,33%, 73%)'
ctx.fillStyle = 'rgb('+ [
127 + 127 * Math.cos(hue),
127 + 127 * Math.cos(hue + 2),
127 + 127 * Math.cos(hue + 4)
] +')';
Save your code as a PNG image, rename foo.png
to foo.html
,
bootstrap it by adding a snippet of HTML+JS at the end of the file
that reads the pixels of the PNG image and turn them back into code
<!-- PNG IMAGE --><canvas id=c>
<img src=# onload=for(a=c.getContext('2d'),i=e='',
S=String.fromCharCode;
a.drawImage(this,i--,0),t=a.getImageData(0,0,1,1).data[0];)
e+=S(t);
(1,eval)(e)>
Thank you JSConf
@p01 @ferristweetsnow