diff options
[WGL/P] Minor style changes and fixed level loading
1 files changed, 9 insertions, 5 deletions
| -rw-r--r-- | Year 2/Computer Graphics with WebGL/Project/Project.html | 14 |
diff --git a/Year 2/Computer Graphics with WebGL/Project/Project.html b/Year 2/Computer Graphics with WebGL/Project/Project.html index 5708803..5379b6d 100644 --- a/Year 2/Computer Graphics with WebGL/Project/Project.html +++ b/Year 2/Computer Graphics with WebGL/Project/Project.html @@ -57,7 +57,8 @@ h2 { top: 0;
padding: 0.5em;
max-width: 24em;
- max-height: calc(100vh - 0.5em);
+ max-height: calc(100vh - 2em);
+ overflow: auto;
}
#coordinates {
left: 0;
@@ -130,18 +131,21 @@ h2 { window.onresize = resizeglcanvas;
var pauseAnimations = false;
- var startT = -1;
+ var t = 0;
function drawFrame()
{
- if (startT == -1) startT = Date.now();
- var t = Math.floor(Date.now() - startT) / 10; // tenths of a second
+ if (startT == -1) { startT = Date.now(); t = 0; }
+ var candidat = Math.floor(Date.now() - startT) / 10; // tenths of a second
+ if (pauseAnimations) startT += (candidat - t)*10;
+ else t = candidat;
+
gl.clear(gl.COLOR_BUFFER_BIT+gl.DEPTH_BUFFER_BIT);
updateCamera();
gl.uniform3fv(uEye, pos);
skybox.draw();
- if (!pauseAnimations) animations.forEach((a) => a(t));
+ if (!pauseAnimations || t == 0) animations.forEach((a) => a(t));
stars.forEach((s) => s.draw());
requestAnimationFrame(drawFrame);
|
