Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Computer Graphics with WebGL / Project / Project.html
diff options
context:
space:
mode:
Commitad2776375379600364882b9515d049509509903b (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-08-28 10:08:33 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-08-28 10:08:33 +0300
Filesd94f5b432be8b670826dbefbbdcb40d0ec81e624 /Year 2/Computer Graphics with WebGL/Project/Project.html
uni-projects-ad2776375379600364882b9515d049509509903b.tar
uni-projects-ad2776375379600364882b9515d049509509903b.tar.gz
uni-projects-ad2776375379600364882b9515d049509509903b.zip
Parent43d4296dc06b1d696fe4b236e614a04cb0705b04 (diff)
[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.html14
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);