Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Computer Graphics Fundamentals / 01-Practice-03.10.2022 / exercise1.html
diff options
context:
space:
mode:
1 files changed, 45 insertions, 0 deletions
-rw-r--r--Year 2/Computer Graphics Fundamentals/01-Practice-03.10.2022/exercise1.html45
diff --git a/Year 2/Computer Graphics Fundamentals/01-Practice-03.10.2022/exercise1.html b/Year 2/Computer Graphics Fundamentals/01-Practice-03.10.2022/exercise1.html
new file mode 100644
index 0000000..4968f5c
--- /dev/null
+++ b/Year 2/Computer Graphics Fundamentals/01-Practice-03.10.2022/exercise1.html
@@ -0,0 +1,45 @@
+<html>
+ <head></head>
+ <body>
+ <script src="three.min.js"></script>
+ <script>
+ const scripts = [
+ [ 'Exercise 04', 'ex04.js' ],
+ [ 'Exercise 05', 'ex05.js' ],
+ [ 'Exercise 06', 'ex06.js' ],
+ ];
+ </script>
+ <script>
+ const scrCont = document.createElement('nav');
+ scrCont.id = 'scrCont';
+ document.body.insertBefore(scrCont, document.body.firstChild);
+ const scrSel = document.createElement('select');
+ scrSel.id = 'scrSel';
+ scrCont.appendChild(scrSel);
+
+ function renderScr (index) {
+ var temp = document.createElement('script');
+ temp.src = scripts[index][1];
+ temp.id = scripts[index][1];
+ document.body.appendChild(temp);
+ }
+
+ for (var i = 0; i < scripts.length; i++) {
+ var temp = document.createElement('option');
+ temp.value = i;
+ temp.text = scripts[i][0];
+ scrSel.appendChild(temp);
+ }
+
+ var oldIndex = scrSel.value;
+ renderScr(scrSel.value);
+
+ scrSel.onchange = function() {
+ document.body.removeChild(document.getElementById(scripts[oldIndex][1]));
+ document.body.removeChild(document.getElementsByTagName('canvas')[0]);
+ renderScr(scrSel.value);
+ oldIndex = scrSel.value;
+ }
+ </script>
+ </body>
+</html> \ No newline at end of file