Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
O
official
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吕祺
official
Commits
787ddeb5
Commit
787ddeb5
authored
Mar 13, 2024
by
吕祺
⛹🏽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pic size change & sm optimize
parent
95537dfe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
addThreeD2.js
static/addThreeD2.js
+15
-6
No files found.
static/addThreeD2.js
View file @
787ddeb5
...
@@ -47,8 +47,8 @@ function genMaterialArray(isMobile,en, callback) {
...
@@ -47,8 +47,8 @@ function genMaterialArray(isMobile,en, callback) {
timeline
.
onload
=
function
()
{
timeline
.
onload
=
function
()
{
const
canvas
=
document
.
createElement
(
'canvas'
)
const
canvas
=
document
.
createElement
(
'canvas'
)
const
sprite
=
isMobile
const
sprite
=
isMobile
?
{
w
:
8
192
/
slice
,
h
:
1024
}
?
{
w
:
8
980
/
slice
,
h
:
1024
}
:
{
w
:
1
6384
/
slice
,
h
:
1024
}
:
{
w
:
1
7943
/
slice
,
h
:
1024
}
const
context
=
canvas
.
getContext
(
'2d'
)
const
context
=
canvas
.
getContext
(
'2d'
)
canvas
.
height
=
sprite
.
h
canvas
.
height
=
sprite
.
h
canvas
.
width
=
sprite
.
w
canvas
.
width
=
sprite
.
w
...
@@ -79,7 +79,12 @@ function getWindowWidth() {
...
@@ -79,7 +79,12 @@ function getWindowWidth() {
}
}
function
getWindowHeight
()
{
function
getWindowHeight
()
{
return
window
.
innerHeight
if
(
isMobile
)
{
return
window
.
innerHeight
*
0.9
}
else
{
return
window
.
innerHeight
*
0.66
}
}
}
...
@@ -209,7 +214,7 @@ function changeMobile() {
...
@@ -209,7 +214,7 @@ function changeMobile() {
function
onWindowResize
()
{
function
onWindowResize
()
{
if
(
resizeTimer
)
{
if
(
resizeTimer
)
{
clearTimeout
(
resizeTimer
)
clearTimeout
(
resizeTimer
)
resizeTimer
=
setTimeout
(
handleWindowResize
,
3
0
)
resizeTimer
=
setTimeout
(
handleWindowResize
,
10
0
)
}
}
camera
.
aspect
=
getWindowWidth
()
/
getWindowHeight
()
camera
.
aspect
=
getWindowWidth
()
/
getWindowHeight
()
...
@@ -220,8 +225,12 @@ function onWindowResize() {
...
@@ -220,8 +225,12 @@ function onWindowResize() {
}
}
function
animate
(
time
)
{
function
animate
(
time
)
{
animId
=
requestAnimationFrame
(
animate
)
animId
=
requestAnimationFrame
(
animate
)
cylinderGroup
.
rotation
.
y
=
-
time
*
0.00005
if
(
isMobile
)
{
cylinderMobileGroup
.
rotation
.
y
=
-
time
*
0.00005
cylinderMobileGroup
.
rotation
.
y
=
-
time
*
0.00005
;
}
else
{
cylinderGroup
.
rotation
.
y
=
-
time
*
0.00005
;
}
render
()
render
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment