diff options
| Commit | a940b965c3715d1a56fed4402488b3347b48fa95 (patch) | |
|---|---|---|
| Author | 2022-12-10 20:00:55 +0200 | |
| Committer | 2022-12-10 20:00:55 +0200 | |
| Files | f79baa7a8098bf1873f13fbdbb2aa2479462dbaf | |
| uni-projects-a940b965c3715d1a56fed4402488b3347b48fa95.tar uni-projects-a940b965c3715d1a56fed4402488b3347b48fa95.tar.gz uni-projects-a940b965c3715d1a56fed4402488b3347b48fa95.zip | ||
| Parent | 7cc44d228654856d7b6c81060f850ded4edc9d3f (diff) | |
[OKG/HWK2] Roughly animated about 45 seconds of the character movements
1 files changed, 81 insertions, 15 deletions
| -rw-r--r-- | Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html | 96 |
diff --git a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html index b7de230..fd44bd9 100644 --- a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html +++ b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html @@ -47,8 +47,8 @@ var aspect = window.innerWidth/window.innerHeight;
var camera = new THREE.PerspectiveCamera( 30, aspect );
- camera.position.set( 400, 50, 90 );
- var camLookAt = lookingDirectionVec(camera, [-10, 0, 0]);
+ camera.position.set( 150, 60, -80 ); //175, 60, 70 );
+ var camLookAt = lookingDirectionVec(camera, [0, -20, 100]);//[-5, -10, -1.5]);
camera.lookAt( camLookAt );
function onWindowResize(event)
@@ -79,7 +79,7 @@ * Осветяване
*/
var sun = new THREE.PointLight(0xffffff, 0.3);
- sun.position.set( 0, 100, 00 );
+ sun.position.set( 60, 190, 50 );
sun.target = ground;
sun.castShadow = true;
scene.add( sun );
@@ -99,12 +99,14 @@ jotaro.position.x = 120;
jotaro.position.z = 60;
jotaro.rotation.y = Math.PI / 2;
+ jotaro.posture = {"version":6,"data":[0,[-90,-87.4,-91.3],[3.5,-0.3,0.1],[0,0,2.4],[1.7,0,0],[0],[-6,-6,-0.6],[1.3,0,0],[0],[6,6,-0.6],[7,-0.6,-17.1],[50],[-14.9,0,0],[119.9,100],[-7.5,0.6,-10.5],[23.6],[6.5,0.7,-7.4],[120,100]]};
scene.add(jotaro);
var kira = newKira();
kira.position.x = 180;
kira.position.z = 60;
- kira.rotation.y = -Math.PI / 2;
+ kira.rotation.y = Math.PI / 2;
+ kira.posture = {"version":6,"data":[0,[0,-90,0],[0,0,-2],[0,0,3.5],[1.8,0,0],[0],[-6,-6,-0.6],[-3.7,0,0],[0],[6,6,-0.6],[7,-0.6,-5],[15],[-15,0,0],[10,10],[-50.5,50.6,29.8],[134.1],[-9.3,-31.8,0.5],[79.3,73.8]]};
scene.add(kira);
@@ -172,6 +174,8 @@ ** Анимация (система)
**/
+ const START = 500;
+
// На дъното на файла има animationData променлива. То е обект, чиито атрибути са секунди от началото на анимацията (t).
// Всеки атрибут е масив, който определя всичките "действия" който трябва да се "регистрират"
// Едно "действие" също е масив с шаблон
@@ -182,6 +186,7 @@ var executeBacklog = [];
function fillBacklog() {
for (var time in animationData) {
+ if (parseInt(time) < START) continue;
for (var instruction of animationData[time]) {
if (typeof instruction[3] == "boolean") {
executeBacklog.push({
@@ -218,7 +223,7 @@ var executeHooks = [];
function animate(t)
{
- t = Math.floor(t) / 100; // Време в секунди, с една цифра след запетаята
+ t = Math.floor(t) + START; // Време в секунди, с една цифра след запетаята
while (executeBacklog.length > 0 && executeBacklog[0].start <= t) {
executeHooks.push(executeBacklog.shift());
@@ -238,7 +243,7 @@ if (mo.nrot)
mo.mannequin.rotation.set(...vecBlend(mo.crot, mo.nrot, blendPer));
}
- else {
+ else if (false) {
if (!mo.camposold) mo.camposold = vecToArr(camera.position);
if (!mo.camwatold) mo.camwatold = camLookAt.clone();
if (mo.campos) {
@@ -689,27 +694,88 @@ **/
var animationData = {
- 9: [
+ 200: [
+ [
+ 200, [15, 20, 0], null, false
+ ],
+ ],
+ 550: [
+ [
+ 0, [180, 55, 90], [180, 55, 60], true
+ ],
+ ],
+ 650: [
+ [
+ 50, kira,
+ null,
+ {"version":6,"data":[7.6,[0,-90,0],[0,0,-2],[0.5,-5.2,6],[1.8,0,0],[0],[-6,-6,-0.6],[-3.7,0,0],[0],[6,6,-0.6],[7,-0.6,-11.6],[15],[-15,0,0],[10,10],[-89.9,24.2,33.3],[106.6],[-16.9,-30.3,-15.2],[17.5,36.5]]},
+ null, [0, -0.3, 0]
+ ],
+ ],
+ 850: [
+ [
+ 40, jotaro,
+ null,
+ {"version":6,"data":[7.6,[0,-90,0],[0,0,-25.5],[0,0,5],[8.8,23,0.8],[13.6],[-6,-6,-0.6],[-6,-19.6,-0.8],[8.2],[6,6,-0.6],[10.1,-32,2.2],[40.9],[-15,0,0],[10,10],[-12.5,34.5,0.9],[39.2],[8.3,0,0],[10,10]]},
+ ],
[
- 0, jotaro,
+ 50, kira,
null,
- {"version":6,"data":[7,[0,-90,0],[0.9,3,-21.7],[4.2,1.2,2.5],[6,12.2,15.5],[43.3],[-6,-6,-26.7],[-6,-13.1,18.3],[45.3],[6,6,-22.8],[9.4,-27.2,9.2],[30.3],[-7.5,15,0],[10,10],[-9.3,27.3,9.3],[28.8],[18,-24.3,7.3],[10,10]]},
- [0,-2,0], [0,1.1,0]
+ {"version":6,"data":[7.6,[0,-90,0],[-0.1,-2.5,-12.5],[-0.6,6.2,6],[1.4,5.7,4.5],[15.6],[-6,-6,-0.6],[-2.4,-7,10.7],[31.2],[6,6,-0.6],[5,-2.7,11.7],[14.7],[0,-2.1,-7.9],[10,10],[-5.3,3.5,-7],[37.8],[9.5,7.4,-2],[108.3,86.1]]},
+ null, [0, -1, 0]
],
],
- 12: [
+ 900: [
[
- 0, [170, 40, 55], [120, 50, 60], true
+ 0, [160, 30, 55], [120, 30, 60], true
],
[
- 2, null, [120, 60, 60], true
+ 400, [160, 50, 55], [120, 55, 60], true
],
],
- 14.9: [
+ 1400: [
[
- 0, [150, 40, 65], null, true
+ 50, jotaro,
+ null,
+ {"version":6,"data":[7.6,[-90,-87.4,-91.3],[3.5,-0.3,0.1],[0,0,2.4],[1.7,0,0],[0],[-6,-6,-0.6],[1.3,0,0],[0],[6,6,-0.6],[7,-0.6,-17.1],[50],[-14.9,0,0],[119.9,100],[-7.5,0.6,-19.9],[46.5],[6.5,0.7,-7.4],[120,100]]},
],
],
+ 1450: [
+ [
+ 0, [60, 50, 130], [170, 50, 55], true
+ ]
+ ],
+ 2050: [
+ [
+ 0, [155, 60, 65], [140, 60, 60], true
+ ],
+ ],
+ 2500: [
+ [
+ 100, kira,
+ null,
+ {"version":6,"data":[7.6,[0,-90,0],[-0.1,-2.5,-2.5],[-0.6,6.2,6],[1.4,5.7,4.5],[15.6],[-6,-6,-0.6],[-2.4,-7,10.7],[31.2],[6,6,-0.6],[52.3,-38.5,37.1],[127.7],[35.2,45.4,-24.4],[33.9,34.3],[-5.3,3.5,-6],[34.8],[9.5,7.4,-2],[108.3,86.1]]},
+ null, [0, 0.1, 0]
+ ],
+ [
+ 0, [130, 53, 60], [150, 55, 57], true
+ ],
+ ],
+ 2900: [
+ [
+ 400, jotaro,
+ null,
+ {"version":6,"data":[3.8,[0,-90,0],[-0.6,25.9,0.2],[0.1,-1.2,5.2],[1.9,0,0],[0],[-6,-6,-0.6],[-0.2,0,-0.3],[0.1],[6,6,-0.6],[7,-0.6,-5],[15],[-15,0,0],[10,10],[-23.3,-16.7,44.8],[37.4],[15,-49.3,0],[10,10]]},
+ ]
+ ],
+ 4100: [
+ [
+ 100, kira,
+ null,
+ {"version":6,"data":[11.4,[0,-90,0],[-0.1,-2.5,-2.5],[-0.6,6.2,6],[1.4,5.7,4.5],[15.6],[-6,-6,-0.6],[-2.4,-7,10.7],[31.2],[6,6,-0.6],[5.8,-8.8,-2],[16.9],[8.1,-1,3.8],[1.3,28.5],[-1.2,3.1,-6.2],[34.8],[9.5,7.4,-2],[14.9,9.3]]},
+ null, [0, -1.3, 0]
+ ]
+ ],
};
fillBacklog();
</script>
|
