skinview3d/src/animation.js

15 lines
375 B
JavaScript
Raw Normal View History

2017-10-01 14:00:45 +02:00
let WalkAnimation = (player, time) => {
let skin = player.skin;
let angleRot = time + Math.PI / 2;
// Leg Swing
skin.leftLeg.rotation.x = Math.cos(angleRot);
skin.rightLeg.rotation.x = Math.cos(angleRot + (Math.PI));
// Arm Swing
skin.leftArm.rotation.x = Math.cos(angleRot + (Math.PI));
skin.rightArm.rotation.x = Math.cos(angleRot);
};
export { WalkAnimation };