- Author:
- Anthony Mann
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- webnibbles.co.uk
- Compo:
- classic
- Demo link:
- https://js1k.com/2010-first/demo/99
- Shortlink:
- https://js1k.com/99
- Blog post:
- please update here!
- Bytes:
- 901
- Chars:
- 901
- Submission
ig=document.getElementById("c");ig.width=320;ig.height=240;var p1=0,p2=0,p3=0,p4=0,t1,t2,t3,t4,aSin=[],ti=1,cv=ig.getContext('2d'),cd=cv.createImageData(ig.width,ig.height),rad,i,j,x,idx,as=2.6,fd=0.4,as1=4.4,fd1=2.2,ps=-4.4,ps2=3.3;function init(){var i=512;while(i--){rad=(i*0.703125)*0.0174532;aSin[i]=Math.sin(rad)*1024}}function main(){init();draw()}function rand(va){return Math.random(va)}document.onclick=function(){as=rand(300)*5;fd=rand(300)*10;as1=rand(200)*50;fd2=rand(300)*50;ps=(rand(200)*20)-10;ps2=(rand(200)*40)-20};function draw(){cdData=cd.data;t4=p4;t3=p3;i=320;while(i--){t1=p1+5;t2=p2+3;t3&=511;t4&=511;j=240;while(j--){t1&=511;t2&=511;x=aSin[t1]+aSin[t2]+aSin[t3]+aSin[t4];idx=(i+j*ig.width)*4;cdData[idx+0]=x/as;cdData[idx+1]=x/fd;cdData[idx+2]=x/ps;cdData[idx+3]=255;t1+=5;t2+=3}t4+=as1;t3+=fd1}cd.data=cdData;cv.putImageData(cd,0,0);p1+=ps;p3+=ps2;setTimeout(draw,ti)}main();
- Description
- Plasma effect, click to randomise.
Thanks to Neutek, and greets to #ukscene!
- Base64 encoded
aWc9ZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImMiKTtpZy53aWR0aD0zMjA7aWcuaGVpZ2h0PTI0MDt2YXIgcDE9MCxwMj0wLHAzPTAscDQ9MCx0MSx0Mix0Myx0NCxhU2luPVtdLHRpPTEsY3Y9aWcuZ2V0Q29udGV4dCgnMmQnKSxjZD1jdi5jcmVhdGVJbWFnZURhdGEo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 = 0,
t1, t2, t3, t4,
aSin = [],
ti = 1,
cv = ig.getContext('2d'),
cd = cv.createImageData(ig.width, ig.height),
rad,
i, j, x,
idx,
as = 2.6, fd = 0.4, as1 = 4.4, fd1 = 2.2, ps = -4.4, ps2 = 3.3;
function init() {
var i = 512;
while (i--) {
rad = (i * 0.703125) * 0.0174532;
aSin[i] = Math.sin(rad) * 1024;
}
}
function main() {
init();
draw();
}
function rand(va) {
return Math.random(va);
}
document.onclick = function(){
as = rand(300)*5;
fd = rand(300)*10;
as1 = rand(200)*50;
fd2 = rand(300)*50;
ps = (rand(200)*20)-10;
ps2 = (rand(200)*40)-20;
};
function draw() {
cdData = cd.data;
t4 = p4;
t3 = p3;
i = 320; while(i--) {
t1 = p1 + 5;
t2 = p2 + 3;
t3 &= 511;
t4 &= 511;
j = 240; while(j--) {
t1 &= 511;
t2 &= 511;
x = aSin[t1] + aSin[t2] + aSin[t3] + aSin[t4];
idx = (i + j * ig.width) * 4;
cdData[idx + 0] = x/as;
cdData[idx + 1] = x/fd;
cdData[idx + 2] = x/ps;
cdData[idx + 3] = 255;
t1 += 5;
t2 += 3;
}
t4 += as1;
t3 += fd1;
}
cd.data = cdData;
cv.putImageData(cd, 0, 0);
p1 += ps;
p3 += ps2;
setTimeout ( draw, ti);
}
main();