- Author:
- Darren Schnare
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- Compo:
- classic
- Demo link:
- https://js1k.com/2013-spring/demo/1334
- Shortlink:
- https://js1k.com/1334
- Blog post:
- please update here!
- Bytes:
- 999
- Chars:
- 999
- Submission
d=document;n=b.addEventListener;l=d.createElement;h=b.appendChild;t="equestAnimationFrame";g=window;q=g["r"+t]||g["mozR"+t]||function(u){setTimeout(u,16.66)};b.style.textAlign="center";c.style.border="thin solid black";s=l.call(d,"h1");s.innerHTML="DIGI-SKETCH";b.insertBefore(s,c);s=l.call(d,"div");s.innerHTML="A=left S=right K=up L=down";h.call(b,s);var e,f,j,p,r,v,w;function x(){65==e&&(p-=j);83==e&&(p+=j);75==f&&(r-=j);76==f&&(r+=j);a.fillRect(p,r,1,1);q(x)}c.width=c.height=600;b.focus();
a.fillStyle="#969696";a.fillRect(0,0,600,600);j=1;f=e=0;p=r=300;v=l.call(d,"button");v.innerHTML="Clear";v.onclick=function(){c.width=600;a.fillStyle="#969696";a.fillRect(0,0,600,600);a.fillStyle=w};h.call(b,v);v=v.cloneNode();v.innerHTML="Save";v.onclick=function(){g.location=c.toDataURL()};h.call(b,v);n.call(b,"keydown",function(u,m){m=u.keyCode;e=65==m||83==m?m:e;f=75==m||76==m?m:f});n.call(b,"keyup",function(u){k=u.keyCode;e=65==k||83==k?-1:e;f=75==k||76==k?-1:f});a.fillStyle=w="#1E1E1E";x();
- Description
- Lineographic drawing app.
- Base64 encoded
ZD1kb2N1bWVudDtuPWIuYWRkRXZlbnRMaXN0ZW5lcjtsPWQuY3JlYXRlRWxlbWVudDtoPWIuYXBwZW5kQ2hpbGQ7dD0iZXF1ZXN0QW5pbWF0aW9uRnJhbWUiO2c9d2luZG93O3E9Z1siciIrdF18fGdbIm1velIiK3RdfHxmdW5jdGlvbih1KXtzZXRUaW1lb3V0KHUsMTYuNjYpfTtiLnN0eWxlLnRleHRBbGlnbj0iY2VudG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HlsZT13PSIjMUUxRTFFIjt4KCk7
- Original source
d = document;
n = b.addEventListener;
l = d.createElement;
h = b.appendChild;
t = 'equestAnimationFrame';
g = window;
q = g['r' + t] || g['mozR' + t] || function(fn) { setTimeout(fn, 16.66); };
b.style.textAlign = 'center';
c.style.border = 'thin solid black';
s = l.call(d, 'h1');
s.innerHTML = 'DIGI-SKETCH';
b.insertBefore(s, c);
s = l.call(d, 'div');
s.innerHTML = 'A=left S=right K=up L=down';
h.call(b, s);
m();
function m(w, kx, ky, v, px, py, s, bg, fg) {
w = 600;
c.width = c.height = w;
b.focus();
a.fillStyle = bg = '#969696';
a.fillRect(0,0,w,w);
v = 1;
kx = 0;
ky = 0;
px = py = 300;
s = l.call(d, 'button');
s.innerHTML = 'Clear';
s.onclick = function () { c.width = w; a.fillStyle = bg; a.fillRect(0,0,w,w); a.fillStyle = fg; };
h.call(b, s);
s = s.cloneNode();
s.innerHTML = 'Save';
s.onclick = function () { g.location = c.toDataURL(); };
h.call(b, s);
n.call(b, 'keydown', function (e, k) {
k = e.keyCode;
kx = k==65 || k==83 ? k : kx;
ky = k==75 || k==76 ? k : ky;
});
n.call(b, 'keyup', function (e) {
k = e.keyCode;
kx = k==65 || k==83 ? -1 : kx;
ky = k==75 || k==76 ? -1 : ky;
});
a.fillStyle = fg = '#1E1E1E';
function update() {
if (kx==65) px -= v;
if (kx==83) px += v;
if (ky==75) py -= v;
if (ky==76) py += v;
a.fillRect(px, py, 1, 1);
q(update);
}
update();
}