diff --git a/assets/js/user.utils.js b/assets/js/user.utils.js index 152a7251..e3949cd7 100644 --- a/assets/js/user.utils.js +++ b/assets/js/user.utils.js @@ -2,7 +2,7 @@ * @Author: prpr * @Date: 2016-01-21 13:56:40 * @Last Modified by: printempw -* @Last Modified time: 2016-03-05 18:41:09 +* @Last Modified time: 2016-03-05 20:36:43 */ 'use strict'; @@ -51,11 +51,11 @@ function handleFiles(files, type) { var run = false, stop = false; $("[title='Movements']").click(function(){ stop = !stop; - MSP.stopPlay(stop); + speed = stop ? 0 : 1; }); $("[title='Running']").click(function(){ run = !run; - MSP.playQuickly(run); + speed = run ? 4 : 1; }); $('#model-alex').on('change', function() { diff --git a/libs/three.msp.js b/libs/three.msp.js index 1f79d223..b8690fb8 100755 --- a/libs/three.msp.js +++ b/libs/three.msp.js @@ -48,9 +48,9 @@ scene = new THREE.Scene(); // Skin Part canvas = document.createElement('canvas');; - canvas.width = 64; - canvas.height = 64; - var context = canvas.getContext("2d"); +canvas.width = 64; +canvas.height = 64; +var context = canvas.getContext("2d"); var skinTexture = new THREE.Texture(canvas); skinTexture.magFilter = THREE.NearestFilter; @@ -878,7 +878,7 @@ function RenderSkin() { container = document.getElementById('skinpreview'); renderer = new THREE.WebGLRenderer({alpha: true}); - onWindowResize(); + renderer.setSize(600, 350); window.addEventListener('resize', onWindowResize, false); @@ -898,20 +898,30 @@ function RenderSkin() { isMouseDown = false; }, false); - container.appendChild(renderer.domElement); + var canvas3d = renderer.domElement; + canvas3d.setAttribute('id', 'canvas3d'); + canvas3d.style = ''; + container.appendChild(canvas3d); + onWindowResize(); } function onWindowResize() { camera.aspect = (window.innerWidth - sidebarWidth) / window.innerHeight; camera.updateProjectionMatrix(); - if (window.innerWidth > 768) { - renderer.setSize(container.clientWidth, container.clientWidth/1.8); - } else { - renderer.setSize(container.clientWidth/1.5, container.clientWidth/1.8); - } + var canvas3d = document.getElementById('canvas3d'); + canvas3d.width = 600; + canvas3d.height = 350; + + canvas3d.setSize(container.clientWidth, container.clientWidth/12*7); } +Element.prototype.setSize = function (w, h) { + this.style.width = w + "px"; + this.style.height = h + "px"; + return this; +}; + function Animate() { scene.getObjectByName("cape", false).visible = capeLoaded;