-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
125 lines (107 loc) · 3.95 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
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>lol i hate pizza</title>
<link rel="stylesheet" href="style.css">
<style>
body {
margin: 0; color: black;
}
canvas {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
h1 {
position: absolute;
color: rgb(183, 0, 255);
font-family: Comic Sans MS;
bottom: 200px;
left: 300px;
z-index: 1;
animation: colorChange 1s infinite, rotate 5s linear infinite;
}
td {
padding: 10px;
border: 1px solid #000;
}
@keyframes colorChange {
0% { color: red; }
25% { color: blue; }
50% { color: green; }
75% { color: orange; }
100% { color: red; }
}
@keyframes rotate {
from { transform: translateX(-50%) rotate(0deg); }
to { transform: translateX(-50%) rotate(360deg); }
}
</style>
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
"GLTFLoader": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/loaders/GLTFLoader.js"
}
}
</script>
<script src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
</head>
<body>
<h1>пошел нахуй лололллл:3333</h1>
<script type="module">
import * as THREE from 'three';
import { GLTFLoader } from 'GLTFLoader';
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
const textureLoader = new THREE.TextureLoader();
textureLoader.load('image.jpg', (texture) => {
const aspect = texture.image.width / texture.image.height;
const backgroundGeometry = new THREE.PlaneGeometry(aspect * 2, 2);
const backgroundMaterial = new THREE.MeshBasicMaterial({
map: texture,
side: THREE.DoubleSide
});
const backgroundMesh = new THREE.Mesh(backgroundGeometry, backgroundMaterial);
backgroundMesh.position.z = -5;
scene.add(backgroundMesh);
});
const loader = new GLTFLoader();
let model;
loader.load('model.glb', (gltf) => {
model = gltf.scene;
scene.add(model);
model.position.set(-0.5, 5, -5);
animate();
}, undefined, function (error) {
console.error('Произошла ошибка при загрузке модели:', error);
});
const ambientLight = new THREE.AmbientLight(0xffffff, 1.5);
scene.add(ambientLight);
const pointLight = new THREE.PointLight(0xffffff, 2);
pointLight.position.set(10, 10, 10);
scene.add(pointLight);
camera.position.z = 2;
function animate() {
requestAnimationFrame(animate);
if (model) {
model.rotation.y += 0.01;
}
renderer.render(scene, camera);
}
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
</script>
</body>
</html>