- Author:
- Aaron Dilley
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- Compo:
- classic
- Demo link:
- https://js1k.com/2014-dragons/demo/1782
- Shortlink:
- https://js1k.com/1782
- Blog post:
- please update here!
- Bytes:
- 768
- Chars:
- 768
- Submission
function dB(e,t,n,r,i,s,o,u){c.moveTo(e,t);c.bezierCurveTo(n,r,i,s,o,u);c.save();c.translate(o,u);c.rotate(P);c.translate(-o,-u);c.bezierCurveTo(i,s,n,r,e,t);c.save();c.translate(o,u);c.rotate(P);c.translate(-o,-u)}function dL(){for(var e=0;sX+2*e*len<w;++e){for(var t=0;sY+2*t*len<w;++t){dB(sX+2*e*len,sY+2*t*len,rx1+2*e*len,ry1+2*t*len,rx2+2*e*len,ry2+2*t*len,sX+(2*e+1)*len,sY+2*t*len)}}}var M=Math,R=M.random,F=M.floor,C=M.cos,S=M.sin,P=M.PI,sX=0,sY=0,len=30,r1=F(50*R()),r2=F(50*R()),ang1=2*P*R(),ang2=2*P*R(),rx1=sX+len/2+r1*C(ang1),ry1=sY+r1*S(ang1),rx2=sX+len/2+r2*C(ang2),ry2=sY+r2*S(ang2),w=c.width=c.height=M.max(window.innerWidth,window.innerHeight);c.beginPath();dL();c.translate(w/2,w/2);c.rotate(P/2);c.translate(-w/2,-w/2);dL();c.lineWidth=1;c.stroke()
- Description
- Generates a random full screen tessellation.
- Base64 encoded
ZnVuY3Rpb24gZEIoZSx0LG4scixpLHMsbyx1KXtjLm1vdmVUbyhlLHQpO2MuYmV6aWVyQ3VydmVUbyhuLHIsaSxzLG8sdSk7Yy5zYXZlKCk7Yy50cmFuc2xhdGUobyx1KTtjLnJvdGF0ZShQKTtjLnRyYW5zbGF0ZSgtbywtdSk7Yy5iZXppZXJDdXJ2ZVRvKGkscyxuLHIsZSx0KTtjLnNhdmUoKTtjLnRyYW5zbGF0ZShvLHUpO2Mucm90YXRlKFApO2MudHJhbnNsYXRlKC1vLC11KX1mdW5jdGlvbiBkTCgpe2Zvcih2YXIgZT0wO3NYKzIqZSpsZW48dzsrK2Upe2Zvcih2YXIgdD0wO3NZKzIqdCpsZW48dzsrK3Qpe2RCKHNYKzIqZSpsZW4sc1krMip0KmxlbixyeDErMiplKmxlbixyeTErMip0KmxlbixyeDIrMiplKmxlbixyeTIrMip0KmxlbixzWCsoMiplKzEpKmxlbixzWSsyKnQqbGVuKX19fXZhciBNPU1hdGgsUj1NLnJhbmRvbSxGPU0uZmxvb3IsQz1NLmNvcyxTPU0uc2luLFA9TS5QSSxzWD0wLHNZPTAsbGVuPTMwLHIxPUYoNTAqUigpKSxyMj1GKDUwKlIoKSksYW5nMT0yKlAqUigpLGFuZzI9MipQKlIoKSxyeDE9c1grbGVuLzIrcjEqQyhhbmcxKSxyeTE9c1krcjEqUyhhbmcxKSxyeDI9c1grbGVuLzIrcjIqQyhhbmcyKSxyeTI9c1krcjIqUyhhbmcyKSx3PWMud2lkdGg9Yy5oZWlnaHQ9TS5tYXgod2luZG93LmlubmVyV2lkdGgsd2luZG93LmlubmVySGVpZ2h0KTtjLmJlZ2luUGF0aCgpO2RMKCk7Yy50cmFuc2xhdGUody8yLHcvMik7Yy5yb3RhdGUoUC8yKTtjLnRyYW5zbGF0ZSgtdy8yLC13LzIpO2RMKCk7Yy5saW5lV2lkdGg9MTtjLnN0cm9rZSgp
- Original source
var M = Math,
R = M.random,
F = M.floor,
C = M.cos,
S = M.sin,
P = M.PI,
sX = 0,
sY = 0,
len = 30,
r1 = F(50*R()),
r2 = F(50*R()),
ang1 = 2*P*R(),
ang2 = 2*P*R(),
rx1 = sX + len/2 + r1*C(ang1),
ry1 = sY + r1*S(ang1),
rx2 = sX + len/2 + r2*C(ang2),
ry2 = sY + r2*S(ang2),
w = c.width = c.height = M.max(window.innerWidth,window.innerHeight);
function drawBase(x0,y0,x1,y1,x2,y2,x3,y3) {
c.moveTo(x0,y0);
c.bezierCurveTo(x1,y1,x2,y2,x3,y3);
c.save();
c.translate(x3,y3);
c.rotate(P);
c.translate(-x3,-y3);
c.bezierCurveTo(x2,y2,x1,y1,x0,y0);
c.save();
c.translate(x3,y3);
c.rotate(P);
c.translate(-x3,-y3);
}
function drawLines() {
for(var i = 0; sX + 2*i*len < w; ++i) {
for(var j = 0; sY + 2*j*len < w; ++j) {
drawBase(sX + 2*i*len,sY + 2*j*len,rx1 + 2*i*len,ry1 + 2*j*len,rx2 + 2*i*len,ry2 + 2*j*len,sX + (2*i + 1)*len,sY + 2*j*len);
}
}
}
c.beginPath();
drawLines();
c.translate(w/2,w/2);
c.rotate(P/2);
c.translate(-w/2,-w/2);
drawLines();
c.lineWidth = 1;
c.stroke();