gl and clicking fiexs
This commit is contained in:
parent
2c842d5b0f
commit
588f5c09d8
2 changed files with 7 additions and 3 deletions
|
@ -33,7 +33,7 @@
|
||||||
void main() {
|
void main() {
|
||||||
// gl_FragColor is a special variable a fragment shader
|
// gl_FragColor is a special variable a fragment shader
|
||||||
// is responsible for setting
|
// is responsible for setting
|
||||||
float dist = (log(distance(b_position.xy,vec2(0.0))) - size_thing) / log(2.0) * 0.1;
|
float dist = (log(distance(b_position.xy,vec2(0.0))) - size_thing + dist_thing) / log(2.0) * 0.1;
|
||||||
gl_FragColor = vec4((mod(dist,0.1) - 0.1 + 0.1 * dist_thing) * 50.0 * vec3(1,1,1),1); // return redish-purple
|
gl_FragColor = vec4((mod(dist,0.1) - 0.1 + 0.1 * dist_thing) * 50.0 * vec3(1,1,1),1); // return redish-purple
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ function renderThing() {
|
||||||
hud.textContent = `${Math.floor(nothingness * 100) / 100} nothings; ${Math.floor(nGain * 60 * 100) / 100} nil/sec`
|
hud.textContent = `${Math.floor(nothingness * 100) / 100} nothings; ${Math.floor(nGain * 60 * 100) / 100} nil/sec`
|
||||||
|
|
||||||
gl.uniform1f(sizeBuffer, -Math.log(nothingness));
|
gl.uniform1f(sizeBuffer, -Math.log(nothingness));
|
||||||
gl.uniform1f(distBuffer, 0.1 + nGain / (nothingness+10));
|
gl.uniform1f(distBuffer, 0.1 + 3 * nGain/(nGain+1));
|
||||||
|
|
||||||
var primitiveType = gl.TRIANGLES;
|
var primitiveType = gl.TRIANGLES;
|
||||||
var offset = 0;
|
var offset = 0;
|
||||||
|
@ -121,6 +121,11 @@ requestAnimationFrame(renderThing)
|
||||||
|
|
||||||
let clicking = false;
|
let clicking = false;
|
||||||
|
|
||||||
|
setInterval(function() {
|
||||||
|
|
||||||
|
nothingness += nGain;
|
||||||
|
},1000 / 60)
|
||||||
|
|
||||||
document.body.onclick = async function() {
|
document.body.onclick = async function() {
|
||||||
if (clicking) return;
|
if (clicking) return;
|
||||||
clicking = true;
|
clicking = true;
|
||||||
|
@ -128,7 +133,6 @@ document.body.onclick = async function() {
|
||||||
nGain += 0.05;
|
nGain += 0.05;
|
||||||
while (nGain > oldNGain) {
|
while (nGain > oldNGain) {
|
||||||
nGain -= 0.005;
|
nGain -= 0.005;
|
||||||
nothingness += nGain;
|
|
||||||
await new Promise((res) => setTimeout(res,1000 / 60))
|
await new Promise((res) => setTimeout(res,1000 / 60))
|
||||||
}
|
}
|
||||||
nGain = oldNGain;
|
nGain = oldNGain;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue