소스 검색

Examples: Clean up webgl_loader_mmd_audio.

Mugen87 5 년 전
부모
커밋
bb43853b96
3개의 변경된 파일18개의 추가작업 그리고 9개의 파일을 삭제
  1. 0 2
      examples/js/animation/MMDAnimationHelper.js
  2. 0 2
      examples/jsm/animation/MMDAnimationHelper.js
  3. 18 5
      examples/webgl_loader_mmd_audio.html

+ 0 - 2
examples/js/animation/MMDAnimationHelper.js

@@ -949,8 +949,6 @@ THREE.MMDAnimationHelper = ( function () {
 			// 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration
 			// 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration
 			if ( ( this.currentTime - this.delayTime ) > this.audioDuration ) return false;
 			if ( ( this.currentTime - this.delayTime ) > this.audioDuration ) return false;
 
 
-			this.audio.startTime = this.currentTime - this.delayTime;
-
 			return true;
 			return true;
 
 
 		},
 		},

+ 0 - 2
examples/jsm/animation/MMDAnimationHelper.js

@@ -958,8 +958,6 @@ var MMDAnimationHelper = ( function () {
 			// 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration
 			// 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration
 			if ( ( this.currentTime - this.delayTime ) > this.audioDuration ) return false;
 			if ( ( this.currentTime - this.delayTime ) > this.audioDuration ) return false;
 
 
-			this.audio.startTime = this.currentTime - this.delayTime;
-
 			return true;
 			return true;
 
 
 		},
 		},

+ 18 - 5
examples/webgl_loader_mmd_audio.html

@@ -7,7 +7,6 @@
 		<link type="text/css" rel="stylesheet" href="main.css">
 		<link type="text/css" rel="stylesheet" href="main.css">
 		<style>
 		<style>
 			body {
 			body {
-				background-color: #fff;
 				color: #444;
 				color: #444;
 			}
 			}
 			a {
 			a {
@@ -17,6 +16,12 @@
 	</head>
 	</head>
 
 
 	<body>
 	<body>
+		<div id="overlay">
+			<div>
+				<button id="startButton">Click to Play</button>
+				<p>Audio playback requires user interaction.</p>
+			</div>
+		</div>
 		<div id="info">
 		<div id="info">
 		<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - MMDLoader test<br />
 		<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - MMDLoader test<br />
 		<a href="https://github.com/mrdoob/three.js/tree/master/examples/models/mmd#readme" target="_blank" rel="noopener">MMD Assets license</a><br />
 		<a href="https://github.com/mrdoob/three.js/tree/master/examples/models/mmd#readme" target="_blank" rel="noopener">MMD Assets license</a><br />
@@ -46,17 +51,25 @@
 
 
 			var clock = new THREE.Clock();
 			var clock = new THREE.Clock();
 
 
-			Ammo().then( function ( AmmoLib ) {
+			var startButton = document.getElementById( 'startButton' );
+			startButton.addEventListener( 'click', function() {
+
+				Ammo().then( function ( AmmoLib ) {
 
 
-				Ammo = AmmoLib;
+					Ammo = AmmoLib;
 
 
-				init();
-				animate();
+					init();
+					animate();
+
+				} );
 
 
 			} );
 			} );
 
 
 			function init() {
 			function init() {
 
 
+				var overlay = document.getElementById( 'overlay' );
+				overlay.remove();
+
 				container = document.createElement( 'div' );
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
 				document.body.appendChild( container );