-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,348 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>网页走丢了~_~</title> | ||
<script src="https://letmefly.xyz/Links/Common.js"></script> | ||
|
||
<style> | ||
html,body{ | ||
margin:0px; | ||
width:100%; | ||
height:100%; | ||
overflow:hidden; | ||
background:#000; | ||
} | ||
|
||
#canvas{ | ||
position:absolute; | ||
width:100%; | ||
height:100%; | ||
} | ||
</style> | ||
|
||
</head> | ||
<body> | ||
<script id="colorful404By_LetMeFly"> | ||
function addA404Pic() { | ||
setTimeout(() => { | ||
const window_width = window.outerWidth; | ||
const window_height = window.outerHeight; | ||
const height = window_height / 8 * 1.3, width = height * 2; | ||
const canvas_404 = document.createElement("canvas"); | ||
canvas_404.width = width, canvas_404.height = height; | ||
canvas_404.style = "position: absolute; left: " + window_width / 8 + "px; top: " + window_height / 8 * 5 + "px; z-index: 9999"; | ||
document.body.insertAdjacentElement('beforeend', canvas_404); | ||
const ctx_404 = canvas_404.getContext('2d'); | ||
const img_404 = document.createElement("img"); | ||
img_404.id="img_404"; | ||
img_404.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAAApCAQAAADq6X1WAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQflBxQSKCsJRRy9AAAE20lEQVRYw9VYW2gcVRj+ZnY2u9k0m9ltbpBK2oq1SDEU8yAWCsHooqVRUkMSk81uVpJYbW0lDWkgUpOKaY2KYLsRiVTaisF4eYjBRMH1QQXBKwiiTxUEG9Gaetkmze6MD5tsds5/Zs7ZjQj+8zBz/ut3/nP+cxngf0XKv+2vs3qlX7sNSF8xp5KzM8n/DG6v2/8+Ea+M322n3xHzhXV4oEAFABhIIYkrycUWWdCHE17CG2/IbWn2xtpsMeHFmsa5uq115S8Esy0j69wPv+/6bCB5fp8Y7IO1OuH5vmUw2ec26GZ5RnrbEk83PLnlRvt+F6HWdyixEJq+7gy36lXKGzpsbat2xi46EbD3Pp5m9JVaB7AZCqBm3lkj1rSJdvQTlmMHVwkSlvpH6G+qGNlbs12mXktxKOHYoccp74lhSbiPvkcFTz7A0ywfsR0ghnR0R+xkkX20TvwfUj1urJYK3WPC+qRSygrVjN5bDFPyAYJRO7jlx0D0B05Kwq18gxqP3cXTLBvgAfP9WP6x6y/K9yJcwvPS2e4luhXneZqcGrnH46e9+pWfFR/huH9bmzRfbX3zHBngFxGjXqp6Ke/IOXCIk93tc4DBPKOtsCFWc32G777k/oyVatuoh+jRIuLFP82PRuB2bKG51S4pBs+4fyfLSVn0TgyR3HO8BDjL42BcEq5+gSqNxvjGpcR6OZ3bUkwIKXacbrw7TttpM3M3etMmsDHMRfuwrCAlkFNHZSGq0z1nF4/JT8nLdMk/1SzOUaHUNe4hvIqn7fUt2T2wk+bW943TkIpGm5WzJbC5nno49oEk3MoJWlEnjtobL8OAMznLu8Y0onHLiJNFzmTouJMeMrxfIi8SwbdS4HaWY6L7I0m4+jAVn+zPD66Icoc+8k4Rkd/8iLN9djJ07CkmM61iDgISVb5TW9eptOc753jZ7Pqfonv84GkIiLUwpOWdFzUi3dMnirea3bYo3f1L3s28wzNey6Q2MdkgciskZXMN6brZ/EPmq4c5GWvNE79b4AYitEhGn8u8vbCWYO4QFroydL2uEllX8/OrX2zJr6/NKgC0d9ONsPotHjxeW1aWS2VVtGO7F8V2KgDoXTTs4BnJyI7Eh9+RoOfWXWEZfxrQesRD3N6Qcz83GGnuIIozb3JaQbrbpXp+EnVyFW7gfir+eqBtYO3bTczbEyaAqQbxJsvrTmRYJfxlrS1bXjTez2+3AUg3Tqc1wMUpCN0RRHmWV0ipqRxuESocrDIn8MsA1Hw3zlyi/zkUwR2+8FhrXS2QDADPfs9yXZYaCtezctmVwwGu7MWbvYYDSprlerA/50KkPkOu/6ugC41YcHbtslU10RQBgFCwJVFKpkb9gIRTB9KQRV4IUPNPlFr5HtREH4oaKILG8dv3xcNkYcyHNpjdugM8l174uL82zSWZy6YTaYB3weWoslRpMoNavABkrrx9K49dXqmWDRbfHwfgvepZcNa7xmzR3l/Wuinx8zAy42NOZC9ZTmQHE2IfAHDr5MHX5DRZj2XNp1ZPZBKTQbTRxhtlIOify4KldDX7tcG5CwBKOt7oEvwZrzs7tsE1IUOi396SgBH6NHThOF+qJs80Ken8PG4ALrvQ8TfSO+Yxf23ryNDijnWee3HXdO+UYpzNExQ73dYL7B8hzwgj8LB6vwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0wNy0yMFQxMDo0MDo0MyswODowMNh2t8IAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDctMjBUMTA6NDA6NDMrMDg6MDCpKw9+AAAAAElFTkSuQmCC"; | ||
img_404.hidden=true; | ||
document.body.appendChild(img_404); | ||
ctx_404.drawImage(img_404, 0, 0, width, height); | ||
const img_404_on_canvas = ctx_404.getImageData(0, 0, width, height); | ||
const img_404_data = img_404_on_canvas.data; | ||
var color = [1, 1, 5]; | ||
const delayTime = 50, colorDiff = [5, 7, 9]; | ||
function changeColor() { | ||
for (var i = 0; i < 3; i++) { | ||
color[i] = (color[i] + colorDiff[i]) % 254 + 1; | ||
} | ||
for (var i = 0; i < img_404_data.length; i += 4) { | ||
var have0 = 0; | ||
for (var j = 0; j < 4; j++) { | ||
if (img_404_data[i + j] == 0) { | ||
have0 = 1; | ||
} | ||
} | ||
if (have0 == 0) { | ||
img_404_data[i] = color[0]; | ||
img_404_data[i + 1] = color[1]; | ||
img_404_data[i + 2] = color[2]; | ||
img_404_data[i + 3] = 80; | ||
} | ||
} | ||
img_404_on_canvas.data = img_404_data; | ||
ctx_404.putImageData(img_404_on_canvas, 0, 0); | ||
setTimeout(() => { | ||
changeColor(); | ||
}, delayTime); | ||
} | ||
changeColor(); | ||
}, 0); | ||
function ifRefresh(){ | ||
const href = location.href; | ||
var temp = href.split('?'); | ||
if (temp.length == 1){ | ||
return true; | ||
} | ||
temp = temp[1]; | ||
if (temp == 'reload'){ | ||
return false; | ||
} | ||
return true; | ||
} | ||
if(ifRefresh()){ | ||
location.href = location.href.split('?')[0]+'?reload'; | ||
} // 我也不知道为什么需要刷新一下才能显示404小图片 | ||
} | ||
addA404Pic(); | ||
</script> | ||
|
||
<canvas id="canvas"></canvas> | ||
|
||
<script> | ||
function project3D(x,y,z,vars){ | ||
|
||
var p,d; | ||
x-=vars.camX; | ||
y-=vars.camY-8; | ||
z-=vars.camZ; | ||
p=Math.atan2(x,z); | ||
d=Math.sqrt(x*x+z*z); | ||
x=Math.sin(p-vars.yaw)*d; | ||
z=Math.cos(p-vars.yaw)*d; | ||
p=Math.atan2(y,z); | ||
d=Math.sqrt(y*y+z*z); | ||
y=Math.sin(p-vars.pitch)*d; | ||
z=Math.cos(p-vars.pitch)*d; | ||
var rx1=-1000; | ||
var ry1=1; | ||
var rx2=1000; | ||
var ry2=1; | ||
var rx3=0; | ||
var ry3=0; | ||
var rx4=x; | ||
var ry4=z; | ||
var uc=(ry4-ry3)*(rx2-rx1)-(rx4-rx3)*(ry2-ry1); | ||
var ua=((rx4-rx3)*(ry1-ry3)-(ry4-ry3)*(rx1-rx3))/uc; | ||
var ub=((rx2-rx1)*(ry1-ry3)-(ry2-ry1)*(rx1-rx3))/uc; | ||
if(!z)z=0.000000001; | ||
if(ua>0&&ua<1&&ub>0&&ub<1){ | ||
return { | ||
x:vars.cx+(rx1+ua*(rx2-rx1))*vars.scale, | ||
y:vars.cy+y/z*vars.scale, | ||
d:(x*x+y*y+z*z) | ||
}; | ||
}else{ | ||
return { d:-1 }; | ||
} | ||
} | ||
|
||
|
||
function elevation(x,y,z){ | ||
|
||
var dist = Math.sqrt(x*x+y*y+z*z); | ||
if(dist && z/dist>=-1 && z/dist <=1) return Math.acos(z / dist); | ||
return 0.00000001; | ||
} | ||
|
||
|
||
function rgb(col){ | ||
|
||
col += 0.000001; | ||
var r = parseInt((0.5+Math.sin(col)*0.5)*16); | ||
var g = parseInt((0.5+Math.cos(col)*0.5)*16); | ||
var b = parseInt((0.5-Math.sin(col)*0.5)*16); | ||
return "#"+r.toString(16)+g.toString(16)+b.toString(16); | ||
} | ||
|
||
|
||
function interpolateColors(RGB1,RGB2,degree){ | ||
|
||
var w2=degree; | ||
var w1=1-w2; | ||
return [w1*RGB1[0]+w2*RGB2[0],w1*RGB1[1]+w2*RGB2[1],w1*RGB1[2]+w2*RGB2[2]]; | ||
} | ||
|
||
|
||
function rgbArray(col){ | ||
|
||
col += 0.000001; | ||
var r = parseInt((0.5+Math.sin(col)*0.5)*256); | ||
var g = parseInt((0.5+Math.cos(col)*0.5)*256); | ||
var b = parseInt((0.5-Math.sin(col)*0.5)*256); | ||
return [r, g, b]; | ||
} | ||
|
||
|
||
function colorString(arr){ | ||
|
||
var r = parseInt(arr[0]); | ||
var g = parseInt(arr[1]); | ||
var b = parseInt(arr[2]); | ||
return "#"+("0" + r.toString(16) ).slice (-2)+("0" + g.toString(16) ).slice (-2)+("0" + b.toString(16) ).slice (-2); | ||
} | ||
|
||
|
||
function process(vars){ | ||
|
||
|
||
if(vars.points.length<vars.initParticles) for(var i=0;i<5;++i) spawnParticle(vars); | ||
var p,d,t; | ||
|
||
p = Math.atan2(vars.camX, vars.camZ); | ||
d = Math.sqrt(vars.camX * vars.camX + vars.camZ * vars.camZ); | ||
d -= Math.sin(vars.frameNo / 80) / 25; | ||
t = Math.cos(vars.frameNo / 300) / 165; | ||
vars.camX = Math.sin(p + t) * d; | ||
vars.camZ = Math.cos(p + t) * d; | ||
vars.camY = -Math.sin(vars.frameNo / 220) * 15; | ||
vars.yaw = Math.PI + p + t; | ||
vars.pitch = elevation(vars.camX, vars.camZ, vars.camY) - Math.PI / 2; | ||
|
||
var t; | ||
for(var i=0;i<vars.points.length;++i){ | ||
|
||
x=vars.points[i].x; | ||
y=vars.points[i].y; | ||
z=vars.points[i].z; | ||
d=Math.sqrt(x*x+z*z)/1.0075; | ||
t=.1/(1+d*d/5); | ||
p=Math.atan2(x,z)+t; | ||
vars.points[i].x=Math.sin(p)*d; | ||
vars.points[i].z=Math.cos(p)*d; | ||
vars.points[i].y+=vars.points[i].vy*t*((Math.sqrt(vars.distributionRadius)-d)*2); | ||
if(vars.points[i].y>vars.vortexHeight/2 || d<.25){ | ||
vars.points.splice(i,1); | ||
spawnParticle(vars); | ||
} | ||
} | ||
} | ||
|
||
function drawFloor(vars){ | ||
|
||
var x,y,z,d,point,a; | ||
for (var i = -25; i <= 25; i += 1) { | ||
for (var j = -25; j <= 25; j += 1) { | ||
x = i*2; | ||
z = j*2; | ||
y = vars.floor; | ||
d = Math.sqrt(x * x + z * z); | ||
point = project3D(x, y-d*d/85, z, vars); | ||
if (point.d != -1) { | ||
size = 1 + 15000 / (1 + point.d); | ||
a = 0.15 - Math.pow(d / 50, 4) * 0.15; | ||
if (a > 0) { | ||
vars.ctx.fillStyle = colorString(interpolateColors(rgbArray(d/26-vars.frameNo/40),[0,128,32],.5+Math.sin(d/6-vars.frameNo/8)/2)); | ||
vars.ctx.globalAlpha = a; | ||
vars.ctx.fillRect(point.x-size/2,point.y-size/2,size,size); | ||
} | ||
} | ||
} | ||
} | ||
vars.ctx.fillStyle = "#82f"; | ||
for (var i = -25; i <= 25; i += 1) { | ||
for (var j = -25; j <= 25; j += 1) { | ||
x = i*2; | ||
z = j*2; | ||
y = -vars.floor; | ||
d = Math.sqrt(x * x + z * z); | ||
point = project3D(x, y+d*d/85, z, vars); | ||
if (point.d != -1) { | ||
size = 1 + 15000 / (1 + point.d); | ||
a = 0.15 - Math.pow(d / 50, 4) * 0.15; | ||
if (a > 0) { | ||
vars.ctx.fillStyle = colorString(interpolateColors(rgbArray(-d/26-vars.frameNo/40),[32,0,128],.5+Math.sin(-d/6-vars.frameNo/8)/2)); | ||
vars.ctx.globalAlpha = a; | ||
vars.ctx.fillRect(point.x-size/2,point.y-size/2,size,size); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
function sortFunction(a,b){ | ||
return b.dist-a.dist; | ||
} | ||
|
||
function draw(vars){ | ||
|
||
vars.ctx.globalAlpha=.15; | ||
vars.ctx.fillStyle="#000"; | ||
vars.ctx.fillRect(0, 0, canvas.width, canvas.height); | ||
|
||
drawFloor(vars); | ||
|
||
var point,x,y,z,a; | ||
for(var i=0;i<vars.points.length;++i){ | ||
x=vars.points[i].x; | ||
y=vars.points[i].y; | ||
z=vars.points[i].z; | ||
point=project3D(x,y,z,vars); | ||
if(point.d != -1){ | ||
vars.points[i].dist=point.d; | ||
size=1+vars.points[i].radius/(1+point.d); | ||
d=Math.abs(vars.points[i].y); | ||
a = .8 - Math.pow(d / (vars.vortexHeight/2), 1000) * .8; | ||
vars.ctx.globalAlpha=a>=0&&a<=1?a:0; | ||
vars.ctx.fillStyle=rgb(vars.points[i].color); | ||
if(point.x>-1&&point.x<vars.canvas.width&&point.y>-1&&point.y<vars.canvas.height)vars.ctx.fillRect(point.x-size/2,point.y-size/2,size,size); | ||
} | ||
} | ||
vars.points.sort(sortFunction); | ||
} | ||
|
||
|
||
function spawnParticle(vars){ | ||
|
||
var p,ls; | ||
pt={}; | ||
p=Math.PI*2*Math.random(); | ||
ls=Math.sqrt(Math.random()*vars.distributionRadius); | ||
pt.x=Math.sin(p)*ls; | ||
pt.y=-vars.vortexHeight/2; | ||
pt.vy=vars.initV/20+Math.random()*vars.initV; | ||
pt.z=Math.cos(p)*ls; | ||
pt.radius=200+800*Math.random(); | ||
pt.color=pt.radius/1000+vars.frameNo/250; | ||
vars.points.push(pt); | ||
} | ||
|
||
function frame(vars) { | ||
|
||
if(vars === undefined){ | ||
var vars={}; | ||
vars.canvas = document.querySelector("canvas"); | ||
vars.ctx = vars.canvas.getContext("2d"); | ||
vars.canvas.width = document.body.clientWidth; | ||
vars.canvas.height = document.body.clientHeight; | ||
window.addEventListener("resize", function(){ | ||
vars.canvas.width = document.body.clientWidth; | ||
vars.canvas.height = document.body.clientHeight; | ||
vars.cx=vars.canvas.width/2; | ||
vars.cy=vars.canvas.height/2; | ||
}, true); | ||
vars.frameNo=0; | ||
|
||
vars.camX = 0; | ||
vars.camY = 0; | ||
vars.camZ = -14; | ||
vars.pitch = elevation(vars.camX, vars.camZ, vars.camY) - Math.PI / 2; | ||
vars.yaw = 0; | ||
vars.cx=vars.canvas.width/2; | ||
vars.cy=vars.canvas.height/2; | ||
vars.bounding=10; | ||
vars.scale=500; | ||
vars.floor=26.5; | ||
|
||
vars.points=[]; | ||
vars.initParticles=700; | ||
vars.initV=.01; | ||
vars.distributionRadius=800; | ||
vars.vortexHeight=25; | ||
} | ||
|
||
vars.frameNo++; | ||
requestAnimationFrame(function() { | ||
frame(vars); | ||
}); | ||
|
||
process(vars); | ||
draw(vars); | ||
} | ||
frame(); | ||
</script> | ||
</body> | ||
</html> | ||
|