Commit 787ddeb5 authored by 吕祺's avatar 吕祺 ⛹🏽

pic size change & sm optimize

parent 95537dfe
......@@ -47,8 +47,8 @@ function genMaterialArray(isMobile,en, callback) {
timeline.onload = function() {
const canvas = document.createElement('canvas')
const sprite = isMobile
? { w: 8192 / slice, h: 1024 }
: { w: 16384 / slice, h: 1024 }
? { w: 8980 / slice, h: 1024 }
: { w: 17943 / slice, h: 1024 }
const context = canvas.getContext('2d')
canvas.height = sprite.h
canvas.width = sprite.w
......@@ -79,7 +79,12 @@ function getWindowWidth() {
}
function getWindowHeight() {
return window.innerHeight
if(isMobile) {
return window.innerHeight * 0.9
} else {
return window.innerHeight * 0.66
}
}
......@@ -209,7 +214,7 @@ function changeMobile() {
function onWindowResize() {
if (resizeTimer) {
clearTimeout(resizeTimer)
resizeTimer = setTimeout(handleWindowResize, 30)
resizeTimer = setTimeout(handleWindowResize, 100)
}
camera.aspect = getWindowWidth() / getWindowHeight()
......@@ -220,8 +225,12 @@ function onWindowResize() {
}
function animate(time) {
animId = requestAnimationFrame(animate)
cylinderGroup.rotation.y = -time * 0.00005
cylinderMobileGroup.rotation.y = -time * 0.00005
if(isMobile) {
cylinderMobileGroup.rotation.y = -time * 0.00005;
}else {
cylinderGroup.rotation.y = -time * 0.00005;
}
render()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment