Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Computer Graphics with WebGL / Project
diff options
context:
space:
mode:
Commit9adcc3c78ef446761a02d9fd528e9306f324ad19 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-08-28 11:40:55 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-08-28 11:40:55 +0300
Filesc476bc7609fc2a217cf32483c8bd4f5153e1a87c /Year 2/Computer Graphics with WebGL/Project
uni-projects-9adcc3c78ef446761a02d9fd528e9306f324ad19.tar
uni-projects-9adcc3c78ef446761a02d9fd528e9306f324ad19.tar.gz
uni-projects-9adcc3c78ef446761a02d9fd528e9306f324ad19.zip
Parent0f4e5c5bd94d6bf298b6791715cc03ad1f053415 (diff)
[WGL/P] Time now actually is in tents of a second
diff --git a/Year 2/Computer Graphics with WebGL/Project/Project.html b/Year 2/Computer Graphics with WebGL/Project/Project.html
index 7b41cbe..7b62624 100644
--- a/Year 2/Computer Graphics with WebGL/Project/Project.html
+++ b/Year 2/Computer Graphics with WebGL/Project/Project.html
@@ -136,8 +136,8 @@ h2 {
function drawFrame()
{
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;
+ var candidat = Math.floor(Date.now() - startT) / 100; // tenths of a second
+ if (pauseAnimations) startT += (candidat - t)*100;
else t = candidat;
gl.clear(gl.COLOR_BUFFER_BIT+gl.DEPTH_BUFFER_BIT);
diff --git a/Year 2/Computer Graphics with WebGL/Project/level.js b/Year 2/Computer Graphics with WebGL/Project/level.js
index 6d193a3..24944ad 100644
--- a/Year 2/Computer Graphics with WebGL/Project/level.js
+++ b/Year 2/Computer Graphics with WebGL/Project/level.js
@@ -52,13 +52,13 @@ function createLevels() {
"Star passing behind black hole",
"You can see how the black hole (correctly) warps the light of the star behind it when it passes",
[1000,0,650]);
- l1.addStar([1100,0,1000], 10, (t, star) => vecSum(star.center, [-100 * (1 + Math.sin(t/300 + 1.5 * Math.PI)),0,0]));
+ l1.addStar([1100,0,1000], 10, (t, star) => vecSum(star.center, [-100 * (1 + Math.sin(t/30 + 1.5 * Math.PI)),0,0]));
l1.addBlackHole([1000,0,900], 30, undefined);
var l2 = new Level(
"Star gets closer to event horizon",
"As the star passes by behind the black hole, we can see it approaching the event horizon, however, it will never truly reach it and dissapear (at least until it's width becomes smaller than a pixel).",
[1014,0,892]);
- l2.addStar([1070,0,1000], 10, (t, star) => vecSum(star.center, [-t/8,0,0]));
+ l2.addStar([1070,0,1000], 10, (t, star) => vecSum(star.center, [-t,0,0]));
l2.addBlackHole([1000,0,900], 30, undefined);
}