Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitb2cc734e39cf59fd311e66f8888f23ccbf107c55 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-11-21 20:32:41 +0200
Committer
 Syndamia <kamen@syndamia.com>
2022-11-21 20:32:41 +0200
Filesb7b70dccbf1ad2d9377ecc5cc1750deea6409a78
uni-projects-b2cc734e39cf59fd311e66f8888f23ccbf107c55.tar
uni-projects-b2cc734e39cf59fd311e66f8888f23ccbf107c55.tar.gz
uni-projects-b2cc734e39cf59fd311e66f8888f23ccbf107c55.zip
Parent6c4de74e8739761fd0016268419f010ce6f05c47 (diff)
[OKG/HWK2] Implemented system for easy animation management and creation
1 files changed, 30 insertions, 3 deletions
-rw-r--r--Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html33
diff --git a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html
index f2a6986..c81921f 100644
--- a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html
+++ b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html
@@ -92,8 +92,9 @@
var jotaro = newJotaro();
//jotaro.rotation.x = Math.PI / 2;
- jotaro.position.x = 50;
- jotaro.position.z = -120;
+ jotaro.position.x = 120;
+ jotaro.position.z = 60;
+ jotaro.rotation.y = Math.PI / 2;
scene.add(jotaro);
// scene.add(newKira());
@@ -161,9 +162,35 @@
** Анимация
**/
+ var animationData = {
+ 0: [
+ [jotaro, 10, {"version":6,"data":[3.8,[0,-90,0],[0,0,-2],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[0],[6,6,-0.6],[7,-0.6,-5],[15],[-15,0,0],[10,10],[-7,0.6,-5],[15],[15,0,0],[10,10]]}, {"version":6,"data":[3.8,[0,-90,0],[-1.3,0,-2],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[0],[6,6,-0.6],[7,-0.6,-5],[15],[-15,0,0],[10,10],[-86.8,50.3,65.1],[15],[15,0,0],[10,10]]}]
+ ]
+ };
+
+ var executeHooks = [];
function animate(t)
{
- //tailorShop.rotation.y += 0.005;
+ t = Math.floor(t) / 100;
+ if (animationData.hasOwnProperty(t)) {
+ for (var instr of animationData[t]) {
+ executeHooks.push({
+ start: t,
+ end: t + instr[1],
+ mannequin: instr[0],
+ A: instr[2],
+ B: instr[3]
+ });
+ }
+ }
+
+ const executeLength = executeHooks.length;
+ for (var i = 0; i < executeLength; i++) {
+ var mo = executeHooks.shift();
+ mo.mannequin.posture = Mannequin.blend(mo.A, mo.B, (t - mo.start) / mo.end);
+ if (t <= mo.end)
+ executeHooks.push(mo);
+ }
}
/**