-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfloat.html
More file actions
151 lines (124 loc) · 5.88 KB
/
float.html
File metadata and controls
151 lines (124 loc) · 5.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
DCLXVICLAN
<!--
LUME ✨👉 https://github.com/lume/lume
Old Version. See v2: https://codepen.io/trusktr/pen/wvzjgbo
-->
<style>
html,
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background: #178;
background-image:url("../8c8rrQmmK88.jpg")
}
</style>
<a href="https://git.io/typing-svg"><img src="https://readme-typing-svg.herokuapp.com?font=Fira+Code&pause=1000&width=435&lines=👀dclxviclan+swipe🖖+for🤳+play👆+🌐💬+🧞♂️🎮" alt="Typing SVG" /></a>
<lume-scene id="scene" perspective="200" webgl="true">
<lume-point-light position="200 -200 200" id="light2" intensity="7" color="black"></lume-point-light>
<lume-ambient-light id="light1" color="green" intensity="4"></lume-ambient-light>
<lume-perspective-camera id="cam" size="0 1 0" position="0 0 1300" rotation="0 0 1.5" active></lume-perspective-camera>
<lume-gltf-model src="https://rawcdn.githack.com/KhronosGroup/glTF-Sample-Models/8e9a5a6ad1a2790e2333e3eb48a1ee39f9e0e31b/2.0/VC/glTF-Binary/VC.glb" rotation="0 -180 0" size="1 1 1" id="model" scale="400 400 400"></lume-gltf-model>
<lume-gltf-model src="https://rawcdn.githack.com/KhronosGroup/glTF-Sample-Models/8e9a5a6ad1a2790e2333e3eb48a1ee39f9e0e31b/2.0/CesiumMilkTruck/glTF-Binary/CesiumMilkTruck.glb" rotation="0 160 0" size="1 1 1" id="model1" scale="15 15 15"></lume-gltf-model>
<lume-gltf-model src="https://rawcdn.githack.com/KhronosGroup/glTF-Sample-Models/8e9a5a6ad1a2790e2333e3eb48a1ee39f9e0e31b/2.0/RiggedFigure/glTF-Binary/RiggedFigure.glb" rotation="0 160 0" size="20 20 20" id="model2" scale="35 35 35"></lume-gltf-model>
<lume-gltf-model src="https://rawcdn.githack.com/KhronosGroup/glTF-Sample-Models/8e9a5a6ad1a2790e2333e3eb48a1ee39f9e0e31b/2.0/BrainStem/glTF-Binary/BrainStem.glb" rotation="0 160 0" size="20 20 20" id="model3" scale="35 35 35"></lume-gltf-model>
<lume-gltf-model src="./scene.gltf"rotation="0 160 0" size="20 20 20" id="model4" scale="35 35 35"></lume-gltf-model>
</lume-scene>
<script src="https://unpkg.com/lume@0.3.0-alpha.14/dist/global.js"></script>
<script>
var isMove = "false";
LUME.useDefaultNames()
model.position = (x, y, z) => [x,y, 1000]
model1.position = (x, y, z) => [120,y, -430]
model1.rotation = (x, y, z) => [x, y , z]
cam.position = (x, y, z) => [model1.position.x + 50, model1.position.y - 50, model1.position.z + 140]
cam.rotation = (x, y, z) => [x, y, z]
model4.position = (x, y, z) => [x,y,5 - z]
if (model1.rotation.y > -98) {
model1.position = (x, y, z) => [x + Math.random(15, 10),y,Math.random(55,35) + z]
cam.position = (x, y, z) => [model1.position.x + 45, model1.position.y - 55, model1.position.z + 150]
}
else {
model1.position = (x, y, z) => [x + Math.random(-15, -10),y,Math.random(-55, -35) + z]
cam.position = (x, y, z) => [model1.position.x + 55, model1.position.y - 55, model1.position.z + 150]
}
this.keys = [ ];
document.addEventListener('touchstart', e => {
this.touchY = e.changedTouches[0].pageY
this.touchX = e.changedTouches[0].pageX
});
document.addEventListener('touchmove', e => {
const swipeDistance = e.changedTouches[0].pageY - this.touchY;
const swipeDistances = e.changedTouches[0].pageX - this.touchX;
if (swipeDistance < -this.touchTreshold && this.keys.indexOf('swipe up') === -1) this.keys.push('swipe up');
else if (swipeDistance > this.touchTreshold && this.keys.indexOf('swipe down') === -1) {
this.keys.push('swipe down');
if (gameOver) restartGame();
}
if (swipeDistances < -this.touchTreshold && this.keys.indexOf('swipe right') === -1) this.keys.push('swipe right');
else if (swipeDistances > this.touchTreshold && this.keys.indexOf('swipe left') === -1) {1
this.keys.push('swipe left');
//if (gameOver) restartGame();
}
});
document.addEventListener('touchend', e => {
this.keys.splice(this.keys.indexOf('swipe up'), 1);
this.keys.splice(this.keys.indexOf('swipe down'), 1);
});
document.addEventListener('pointermove', event => {
event.preventDefault()
model2.rotation = (x, y, z) => [x,y + 2, z]
model3.rotation = (x, y, z) => [x,y + 27, z]
model2.position = (x, y, z) => [x + 2,-10, -555]
model3.position = (x, y, z) => [x - 2,-10, -365]
model.rotation = (x, y, z) => [x,y, z]
cam.position = (x, y, z) => [model1.position.x + 15, model1.position.y - 55, model1.position.z + 130]
if (model1.rotation.y > -98) {
model1.position = (x, y, z) => [4 +x,y,-400]
cam.position = (x, y, z) => [model1.position.x + 15, model1.position.y - 55, model1.position.z + 130]
}
else {
model1.position = (x, y, z) => [-4 +x,y,-400]
cam.position = (x, y, z) => [model1.position.x + 15, model1.position.y - 55, model1.position.z + 150]
}
})
document.addEventListener('pointerdown', event => {
event.preventDefault()
var isMove = "true";
cam.position = (x, y, z) => [model1.position.x + 15, model1.position.y - 55, model1.position.z + 130]
light1.color = "orange"
light2.color = "green"
model.rotation = (x, y, z) => [x,y, z]
if (model1.rotation.y < (0, 98,0)) {
model1.rotation = (x, y, z) => [x,98, z]
} else {
model1.rotation = (x, y, z) => [x,-98, z]
}
})
document.addEventListener('pointerup', event => {
event.preventDefault()
light1.color = "black"
light2.color = "blue"
model1.position = (x, y, z) => [x,0,z]
var isMove = "false";
model.rotation = (x, y, z) => [x,y, z]
model.position = (x, y, z) => [x,y, z]
model2.rotation = (x, y, z) => [x,y, z]
model3.rotation = (x, y, z) => [x,y, z]
model2.position = (x, y, z) => [x ,-10, -555]
model3.position = (x, y, z) => [x,-10, -365]
cam.position = (x, y, z) => [model1.position.x + 15, model1.position.y - 50, model1.position.z + 150]
})
if (keys.indexOf('swipe left') > -1 ){
model1.position = (x, y, z) => [x, 2 + y , z]
} else if (keys.indexOf('swipe right') > -1 ){
this.speed = -10;
} else if (keys.indexOf('swipe up') > -1){
this.vy -= 32;
} else {
thi;
}
</script>
DCLXVICLAN
Resources