-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathARindex14.html
53 lines (44 loc) · 1.76 KB
/
ARindex14.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
<!DOCTYPE html>
<html>
<head>
<title>MindAR Mask</title>
<script src="https://cdn.jsdelivr.net/npm/mind-ar/dist/mind-ar.js"></script>
</head>
<body>
<video id="mindar-video" autoplay playsinline></video>
<canvas id="mindar-canvas" width="640" height="480"></canvas>
<script>
window.addEventListener('DOMContentLoaded', () => {
// Отримання посилань на елементи video та canvas
const video = document.getElementById('mindar-video');
const canvas = document.getElementById('mindar-canvas');
// Опції MindAR
const mindAROptions = {
video: video,
canvas: canvas,
useVideo: true,
maxFaces: 1 // Максимальна кількість розпізнаних облич
};
// Ініціалізація MindAR з опціями
const mindAR = new MindAR(mindAROptions);
// Завантаження маски обличчя
const maskImage = new Image();
maskImage.src = 'https://images.prom.ua/3843444964_w640_h640_maska-anonimusa.jpg';
// Додавання сцени та маски
mindAR.onARLoad(() => {
// Створення сцени
const scene = new MindAR.Scene();
// Створення об'єкта маски
const mask = new MindAR.Object3D(maskImage);
mask.scale.set(1.5, 1.5, 1.5); // Налаштування розміру маски (за потреби)
// Додавання маски до сцени
scene.addObject(mask);
// Додавання сцени до MindAR
mindAR.addScene(scene);
});
// Запуск MindAR
mindAR.start();
});
</script>
</body>
</html>