This commit is contained in:
yushijinhun 2020-01-07 13:54:21 +08:00
parent a28adef802
commit 8378e72b34
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
2 changed files with 8 additions and 16 deletions

View File

@ -127,8 +127,8 @@
</select>
</div>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/three.js/95/three.min.js"></script>
<script type="text/javascript" src="js/dist/skinview3d.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/three@0.112.1/build/three.min.js"></script>
<script type="text/javascript" src="js/dist/skinview3d.js"></script>
<script type="text/javascript" src="js/example.js"></script>
<script>
initSkinViewer();
@ -136,4 +136,4 @@
</script>
</body>
</html>
</html>

View File

@ -27,7 +27,6 @@ function initSkinViewer() {
});
skinViewer.camera.position.z = 70;
skinViewer.animation = new skinview3d.CompositeAnimation();
control = skinview3d.createOrbitControls(skinViewer);
@ -73,7 +72,7 @@ function resizeSkinViewer() {
}
function pause() {
skinViewer.animationPaused = !skinViewer.animationPaused;
skinViewer.animations.paused = !skinViewer.animations.paused;
}
function walk() {
@ -82,8 +81,7 @@ function walk() {
delete handles.run;
}
handles.walk = handles.walk || skinViewer.animation.add(skinview3d.WalkingAnimation);
handles.walk.speed = globalAnimationSpeed;
handles.walk = handles.walk || skinViewer.animations.add(skinview3d.WalkingAnimation);
}
function run() {
@ -92,16 +90,14 @@ function run() {
delete handles.walk;
}
handles.run = handles.run || skinViewer.animation.add(skinview3d.RunningAnimation);
handles.run.speed = globalAnimationSpeed;
handles.run = handles.run || skinViewer.animations.add(skinview3d.RunningAnimation);
}
function rotate() {
if (handles.rotate) {
handles.rotate.paused = !handles.rotate.paused;
} else {
handles.rotate = skinViewer.animation.add(skinview3d.RotatingAnimation);
handles.rotate.speed = globalAnimationSpeed;
handles.rotate = skinViewer.animations.add(skinview3d.RotatingAnimation);
}
}
@ -113,10 +109,6 @@ function setGlobalAnimationSpeed() {
var currentSpeed = el('speed').value;
if (!isNaN(currentSpeed)) {
globalAnimationSpeed = currentSpeed;
for (var key in handles) {
handles[key].speed = currentSpeed;
}
skinViewer.animations.speed = currentSpeed;
}
}