Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
dc91443e
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
dc91443e
编写于
7月 05, 2016
作者:
M
Michael Blix
提交者:
Mr.doob
7月 06, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Framerate independent animating for WebVR samples (#9292)
上级
b4bc7672
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
10 deletion
+22
-10
examples/webvr_cubes.html
examples/webvr_cubes.html
+11
-7
examples/webvr_rollercoaster.html
examples/webvr_rollercoaster.html
+6
-2
examples/webvr_vive.html
examples/webvr_vive.html
+5
-1
未找到文件。
examples/webvr_cubes.html
浏览文件 @
dc91443e
...
...
@@ -35,6 +35,8 @@
//
var
clock
=
new
THREE
.
Clock
();
var
container
;
var
camera
,
scene
,
raycaster
,
renderer
;
var
effect
,
controls
;
...
...
@@ -177,6 +179,8 @@
function
render
()
{
var
delta
=
clock
.
getDelta
()
*
60
;
if
(
isMouseDown
===
true
)
{
var
cube
=
room
.
children
[
0
];
...
...
@@ -184,9 +188,9 @@
cube
.
position
.
set
(
0
,
0
,
-
0.75
);
cube
.
position
.
applyQuaternion
(
camera
.
quaternion
);
cube
.
userData
.
velocity
.
x
=
(
Math
.
random
()
-
0.5
)
*
0.02
;
cube
.
userData
.
velocity
.
y
=
(
Math
.
random
()
-
0.5
)
*
0.02
;
cube
.
userData
.
velocity
.
z
=
(
Math
.
random
()
*
0.01
-
0.05
);
cube
.
userData
.
velocity
.
x
=
(
Math
.
random
()
-
0.5
)
*
0.02
*
delta
;
cube
.
userData
.
velocity
.
y
=
(
Math
.
random
()
-
0.5
)
*
0.02
*
delta
;
cube
.
userData
.
velocity
.
z
=
(
Math
.
random
()
*
0.01
-
0.05
)
*
delta
;
cube
.
userData
.
velocity
.
applyQuaternion
(
camera
.
quaternion
);
room
.
add
(
cube
);
...
...
@@ -224,7 +228,7 @@
var
cube
=
room
.
children
[
i
];
cube
.
userData
.
velocity
.
multiplyScalar
(
0.999
);
cube
.
userData
.
velocity
.
multiplyScalar
(
1
-
(
0.001
*
delta
)
);
cube
.
position
.
add
(
cube
.
userData
.
velocity
);
...
...
@@ -249,9 +253,9 @@
}
cube
.
rotation
.
x
+=
cube
.
userData
.
velocity
.
x
*
2
;
cube
.
rotation
.
y
+=
cube
.
userData
.
velocity
.
y
*
2
;
cube
.
rotation
.
z
+=
cube
.
userData
.
velocity
.
z
*
2
;
cube
.
rotation
.
x
+=
cube
.
userData
.
velocity
.
x
*
2
*
delta
;
cube
.
rotation
.
y
+=
cube
.
userData
.
velocity
.
y
*
2
*
delta
;
cube
.
rotation
.
z
+=
cube
.
userData
.
velocity
.
z
*
2
*
delta
;
}
...
...
examples/webvr_rollercoaster.html
浏览文件 @
dc91443e
...
...
@@ -204,10 +204,14 @@
var
velocity
=
0
;
var
progress
=
0
;
var
clock
=
new
THREE
.
Clock
();
function
animate
(
time
)
{
effect
.
requestAnimationFrame
(
animate
);
var
delta
=
clock
.
getDelta
()
*
60
;
for
(
var
i
=
0
;
i
<
funfairs
.
length
;
i
++
)
{
funfairs
[
i
].
rotation
.
y
=
time
*
0.0002
;
...
...
@@ -216,7 +220,7 @@
//
progress
+=
velocity
;
progress
+=
velocity
*
delta
;
progress
=
progress
%
1
;
position
.
copy
(
curve
.
getPointAt
(
progress
)
);
...
...
@@ -226,7 +230,7 @@
tangent
.
copy
(
curve
.
getTangentAt
(
progress
)
);
velocity
-=
tangent
.
y
*
0.0000015
;
velocity
-=
tangent
.
y
*
0.0000015
*
delta
;
velocity
=
Math
.
max
(
velocity
,
0.00004
);
train
.
lookAt
(
lookAt
.
copy
(
position
).
sub
(
tangent
)
);
...
...
examples/webvr_vive.html
浏览文件 @
dc91443e
...
...
@@ -38,6 +38,8 @@
//
var
clock
=
new
THREE
.
Clock
();
var
container
;
var
camera
,
scene
,
renderer
;
var
effect
,
controls
;
...
...
@@ -226,6 +228,8 @@
function
render
()
{
var
delta
=
clock
.
getDelta
()
*
60
;
controls
.
update
();
for
(
var
i
=
0
;
i
<
room
.
children
.
length
;
i
++
)
{
...
...
@@ -257,7 +261,7 @@
}
cube
.
rotation
.
x
+=
0.01
;
cube
.
rotation
.
x
+=
0.01
*
delta
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录