forked from jeancode/3dForm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
184 lines (137 loc) · 5.02 KB
/
index.html
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!DOCTYPE html>
<html>
<head>
<title>Formulario 3d</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
html, body {
height: 100%;
overflow: hidden;
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: -webkit-linear-gradient(-45deg, #0de0cd 0%,#00127c 100%);
}
.frame{
background: rgba(0, 0, 0, 0.397);
border-top: 5px solid rgb(45, 243, 200);
width: 300px;
height: 300px;
display: flex;
flex-direction: column;
padding: 10px;
}
.frame label{
font-size: 18px;
color: rgb(37, 37, 37);
-webkit-user-select: none;
color: white;
}
.frame input{
font-size: 18px;
height: 40px;
padding-left: 10px;
margin-top: 8px;
margin-bottom: 8px;
border-radius: 5px;
border:none;
outline: none;
-webkit-transition: all .5s ease;
}
.frame input:focus{
box-shadow: inset 0px 0px 10px black;
-webkit-transition: all .5s ease;
}
.boton{
border: none;
height: 35px;;
margin-top: 25px;
border-radius: 15px;
outline: none;
background: rgba(0, 0, 0, 0.459);
color: white;
border: 1px solid rgb(83, 83, 83);
}
.boton:hover{
background: rgb(38, 140, 235);
color: white;
-webkit-transition: all .5s ease;
}
#creditos{
font-size: 30px;
color:white;
padding-left: 10px;
text-shadow: 0px 0px 10px black;
-webkit-user-select: none;
}
</style>
</head>
<body>
<script src="three.js"></script>
<script src="OrbitControls.js"></script>
<script src="TrackballControls.js"></script>
<script src="CSS3DRenderer.js"></script>
<script src="jquery.js"></script>
<div id="creditos">Jeancode</div>
<div id="container"></div>
<script>
//funcion creada j
function map( x, in_min, in_max, out_min, out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
var camera, scene, renderer;
var controls;
var Element = function ( id, x, y, z, ry ) {
var div = document.createElement( 'div' );
div.className = "frame";
div.innerHTML = `
<label>Usuario</label>
<input type="text" placeholder="Usuario">
<label>Password</label>
<input type="password" placeholder="Password">
<button type="submit" value="Entrar" class="boton">Entrar</button>
<button type="submit" value="Registrar" class="boton">Registrar</button>
`;
var object = new THREE.CSS3DObject( div );
object.position.set( x, y, z );
object.rotation.y = ry;
return object;
};
init();
animate();
function init() {
var container = document.getElementById( 'container' );
camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 1, 5000 );
camera.position.set( 0, 0, 800 );
scene = new THREE.Scene();
renderer = new THREE.CSS3DRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild( renderer.domElement );
var group = new THREE.Group();
group.add( new Element( 'SJOz3qjfQXU', 0, 0, 0, 0 ) );
scene.add( group );
//controls = new THREE.OrbitControls( camera, renderer.domElement );
//controls = new THREE.TrackballControls( camera );
//controls.rotateSpeed = 4;
//controls.maxPolarAngle = Math.PI / 2;
window.addEventListener( 'resize', onWindowResize, false );
window.addEventListener('mousemove',function movemouse(e){
var outx = map(e.screenX,0,window.innerWidth,-.5,.5);
var outy = map(e.screenY,0,window.innerHeight,-.5,.5);
group.rotation.y = outx;
group.rotation.x = outy;
});
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
function animate() {
requestAnimationFrame( animate );
//controls.update();
renderer.render( scene, camera );
}
</script>
</body>
</html>