@srsergio/taptapp-ar 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -0
- package/dist/compiler/aframe.d.ts +1 -0
- package/dist/compiler/aframe.js +275 -0
- package/dist/compiler/compiler-base.d.ts +12 -0
- package/dist/compiler/compiler-base.js +165 -0
- package/dist/compiler/compiler.d.ts +9 -0
- package/dist/compiler/compiler.js +24 -0
- package/dist/compiler/compiler.worker.d.ts +1 -0
- package/dist/compiler/compiler.worker.js +28 -0
- package/dist/compiler/controller.d.ts +101 -0
- package/dist/compiler/controller.js +400 -0
- package/dist/compiler/controller.worker.d.ts +1 -0
- package/dist/compiler/controller.worker.js +61 -0
- package/dist/compiler/detector/crop-detector.d.ts +65 -0
- package/dist/compiler/detector/crop-detector.js +59 -0
- package/dist/compiler/detector/detector.d.ts +98 -0
- package/dist/compiler/detector/detector.js +1049 -0
- package/dist/compiler/detector/freak.d.ts +1 -0
- package/dist/compiler/detector/freak.js +89 -0
- package/dist/compiler/detector/kernels/cpu/binomialFilter.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/binomialFilter.js +51 -0
- package/dist/compiler/detector/kernels/cpu/buildExtremas.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/buildExtremas.js +89 -0
- package/dist/compiler/detector/kernels/cpu/computeExtremaAngles.d.ts +7 -0
- package/dist/compiler/detector/kernels/cpu/computeExtremaAngles.js +79 -0
- package/dist/compiler/detector/kernels/cpu/computeExtremaFreak.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/computeExtremaFreak.js +68 -0
- package/dist/compiler/detector/kernels/cpu/computeFreakDescriptors.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/computeFreakDescriptors.js +57 -0
- package/dist/compiler/detector/kernels/cpu/computeLocalization.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/computeLocalization.js +54 -0
- package/dist/compiler/detector/kernels/cpu/computeOrientationHistograms.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/computeOrientationHistograms.js +118 -0
- package/dist/compiler/detector/kernels/cpu/downsampleBilinear.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/downsampleBilinear.js +29 -0
- package/dist/compiler/detector/kernels/cpu/extremaReduction.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/extremaReduction.js +50 -0
- package/dist/compiler/detector/kernels/cpu/fakeShader.d.ts +20 -0
- package/dist/compiler/detector/kernels/cpu/fakeShader.js +80 -0
- package/dist/compiler/detector/kernels/cpu/index.d.ts +1 -0
- package/dist/compiler/detector/kernels/cpu/index.js +25 -0
- package/dist/compiler/detector/kernels/cpu/prune.d.ts +1 -0
- package/dist/compiler/detector/kernels/cpu/prune.js +103 -0
- package/dist/compiler/detector/kernels/cpu/smoothHistograms.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/smoothHistograms.js +47 -0
- package/dist/compiler/detector/kernels/cpu/upsampleBilinear.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/upsampleBilinear.js +43 -0
- package/dist/compiler/detector/kernels/index.d.ts +1 -0
- package/dist/compiler/detector/kernels/index.js +2 -0
- package/dist/compiler/detector/kernels/webgl/binomialFilter.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/binomialFilter.js +67 -0
- package/dist/compiler/detector/kernels/webgl/buildExtremas.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/buildExtremas.js +101 -0
- package/dist/compiler/detector/kernels/webgl/computeExtremaAngles.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/computeExtremaAngles.js +78 -0
- package/dist/compiler/detector/kernels/webgl/computeExtremaFreak.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/computeExtremaFreak.js +86 -0
- package/dist/compiler/detector/kernels/webgl/computeFreakDescriptors.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/computeFreakDescriptors.js +52 -0
- package/dist/compiler/detector/kernels/webgl/computeLocalization.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/computeLocalization.js +58 -0
- package/dist/compiler/detector/kernels/webgl/computeOrientationHistograms.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/computeOrientationHistograms.js +116 -0
- package/dist/compiler/detector/kernels/webgl/downsampleBilinear.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/downsampleBilinear.js +46 -0
- package/dist/compiler/detector/kernels/webgl/extremaReduction.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/extremaReduction.js +48 -0
- package/dist/compiler/detector/kernels/webgl/index.d.ts +1 -0
- package/dist/compiler/detector/kernels/webgl/index.js +25 -0
- package/dist/compiler/detector/kernels/webgl/smoothHistograms.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/smoothHistograms.js +49 -0
- package/dist/compiler/detector/kernels/webgl/upsampleBilinear.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/upsampleBilinear.js +56 -0
- package/dist/compiler/estimation/esimate-experiment.d.ts +5 -0
- package/dist/compiler/estimation/esimate-experiment.js +267 -0
- package/dist/compiler/estimation/estimate.d.ts +5 -0
- package/dist/compiler/estimation/estimate.js +51 -0
- package/dist/compiler/estimation/estimator.d.ts +13 -0
- package/dist/compiler/estimation/estimator.js +30 -0
- package/dist/compiler/estimation/refine-estimate-experiment.d.ts +6 -0
- package/dist/compiler/estimation/refine-estimate-experiment.js +429 -0
- package/dist/compiler/estimation/refine-estimate.d.ts +6 -0
- package/dist/compiler/estimation/refine-estimate.js +299 -0
- package/dist/compiler/estimation/utils.d.ts +10 -0
- package/dist/compiler/estimation/utils.js +80 -0
- package/dist/compiler/image-list.d.ts +13 -0
- package/dist/compiler/image-list.js +52 -0
- package/dist/compiler/index.d.ts +3 -0
- package/dist/compiler/index.js +10 -0
- package/dist/compiler/input-loader.d.ts +23 -0
- package/dist/compiler/input-loader.js +88 -0
- package/dist/compiler/matching/hamming-distance.d.ts +1 -0
- package/dist/compiler/matching/hamming-distance.js +20 -0
- package/dist/compiler/matching/hierarchical-clustering.d.ts +7 -0
- package/dist/compiler/matching/hierarchical-clustering.js +109 -0
- package/dist/compiler/matching/hough.d.ts +1 -0
- package/dist/compiler/matching/hough.js +169 -0
- package/dist/compiler/matching/matcher.d.ts +28 -0
- package/dist/compiler/matching/matcher.js +48 -0
- package/dist/compiler/matching/matching.d.ts +41 -0
- package/dist/compiler/matching/matching.js +197 -0
- package/dist/compiler/matching/ransacHomography.d.ts +1 -0
- package/dist/compiler/matching/ransacHomography.js +136 -0
- package/dist/compiler/offline-compiler.d.ts +10 -0
- package/dist/compiler/offline-compiler.js +450 -0
- package/dist/compiler/tensorflow-setup.d.ts +7 -0
- package/dist/compiler/tensorflow-setup.js +73 -0
- package/dist/compiler/three.d.ts +66 -0
- package/dist/compiler/three.js +310 -0
- package/dist/compiler/tracker/extract-utils.d.ts +1 -0
- package/dist/compiler/tracker/extract-utils.js +29 -0
- package/dist/compiler/tracker/extract.d.ts +4 -0
- package/dist/compiler/tracker/extract.js +349 -0
- package/dist/compiler/tracker/tracker.d.ts +38 -0
- package/dist/compiler/tracker/tracker.js +327 -0
- package/dist/compiler/utils/cumsum.d.ts +5 -0
- package/dist/compiler/utils/cumsum.js +39 -0
- package/dist/compiler/utils/geometry.d.ts +8 -0
- package/dist/compiler/utils/geometry.js +101 -0
- package/dist/compiler/utils/homography.d.ts +1 -0
- package/dist/compiler/utils/homography.js +138 -0
- package/dist/compiler/utils/images.d.ts +24 -0
- package/dist/compiler/utils/images.js +99 -0
- package/dist/compiler/utils/randomizer.d.ts +5 -0
- package/dist/compiler/utils/randomizer.js +25 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/react/AREditor.d.ts +5 -0
- package/dist/react/AREditor.js +159 -0
- package/dist/react/ProgressDialog.d.ts +13 -0
- package/dist/react/ProgressDialog.js +57 -0
- package/dist/react/types.d.ts +22 -0
- package/dist/react/types.js +14 -0
- package/package.json +53 -0
- package/src/astro/ARScene.astro +59 -0
- package/src/astro/ARVideoTrigger.astro +73 -0
- package/src/astro/overlays/ErrorOverlay.astro +40 -0
- package/src/astro/overlays/LoadingOverlay.astro +28 -0
- package/src/astro/overlays/ScanningOverlay.astro +119 -0
- package/src/astro/scripts/ARScripts.astro +118 -0
- package/src/astro/styles/ARStyles.astro +147 -0
- package/src/compiler/aframe.js +343 -0
- package/src/compiler/compiler-base.js +195 -0
- package/src/compiler/compiler.js +25 -0
- package/src/compiler/compiler.worker.js +30 -0
- package/src/compiler/controller.js +473 -0
- package/src/compiler/controller.worker.js +77 -0
- package/src/compiler/detector/crop-detector.js +68 -0
- package/src/compiler/detector/detector.js +1130 -0
- package/src/compiler/detector/freak.js +91 -0
- package/src/compiler/detector/kernels/cpu/binomialFilter.js +59 -0
- package/src/compiler/detector/kernels/cpu/buildExtremas.js +108 -0
- package/src/compiler/detector/kernels/cpu/computeExtremaAngles.js +91 -0
- package/src/compiler/detector/kernels/cpu/computeExtremaFreak.js +92 -0
- package/src/compiler/detector/kernels/cpu/computeFreakDescriptors.js +68 -0
- package/src/compiler/detector/kernels/cpu/computeLocalization.js +71 -0
- package/src/compiler/detector/kernels/cpu/computeOrientationHistograms.js +141 -0
- package/src/compiler/detector/kernels/cpu/downsampleBilinear.js +33 -0
- package/src/compiler/detector/kernels/cpu/extremaReduction.js +53 -0
- package/src/compiler/detector/kernels/cpu/fakeShader.js +88 -0
- package/src/compiler/detector/kernels/cpu/index.js +26 -0
- package/src/compiler/detector/kernels/cpu/prune.js +114 -0
- package/src/compiler/detector/kernels/cpu/smoothHistograms.js +57 -0
- package/src/compiler/detector/kernels/cpu/upsampleBilinear.js +51 -0
- package/src/compiler/detector/kernels/index.js +2 -0
- package/src/compiler/detector/kernels/webgl/binomialFilter.js +72 -0
- package/src/compiler/detector/kernels/webgl/buildExtremas.js +109 -0
- package/src/compiler/detector/kernels/webgl/computeExtremaAngles.js +82 -0
- package/src/compiler/detector/kernels/webgl/computeExtremaFreak.js +105 -0
- package/src/compiler/detector/kernels/webgl/computeFreakDescriptors.js +56 -0
- package/src/compiler/detector/kernels/webgl/computeLocalization.js +70 -0
- package/src/compiler/detector/kernels/webgl/computeOrientationHistograms.js +129 -0
- package/src/compiler/detector/kernels/webgl/downsampleBilinear.js +50 -0
- package/src/compiler/detector/kernels/webgl/extremaReduction.js +50 -0
- package/src/compiler/detector/kernels/webgl/index.js +26 -0
- package/src/compiler/detector/kernels/webgl/smoothHistograms.js +53 -0
- package/src/compiler/detector/kernels/webgl/upsampleBilinear.js +62 -0
- package/src/compiler/estimation/esimate-experiment.js +316 -0
- package/src/compiler/estimation/estimate.js +67 -0
- package/src/compiler/estimation/estimator.js +34 -0
- package/src/compiler/estimation/refine-estimate-experiment.js +512 -0
- package/src/compiler/estimation/refine-estimate.js +365 -0
- package/src/compiler/estimation/utils.js +97 -0
- package/src/compiler/image-list.js +62 -0
- package/src/compiler/index.js +13 -0
- package/src/compiler/input-loader.js +107 -0
- package/src/compiler/matching/hamming-distance.js +23 -0
- package/src/compiler/matching/hierarchical-clustering.js +131 -0
- package/src/compiler/matching/hough.js +206 -0
- package/src/compiler/matching/matcher.js +59 -0
- package/src/compiler/matching/matching.js +237 -0
- package/src/compiler/matching/ransacHomography.js +192 -0
- package/src/compiler/offline-compiler.js +553 -0
- package/src/compiler/tensorflow-setup.js +88 -0
- package/src/compiler/three.js +368 -0
- package/src/compiler/tracker/extract-utils.js +34 -0
- package/src/compiler/tracker/extract.js +419 -0
- package/src/compiler/tracker/tracker.js +397 -0
- package/src/compiler/utils/cumsum.js +40 -0
- package/src/compiler/utils/geometry.js +114 -0
- package/src/compiler/utils/homography.js +150 -0
- package/src/compiler/utils/images.js +111 -0
- package/src/compiler/utils/randomizer.js +29 -0
- package/src/index.ts +8 -0
- package/src/react/AREditor.tsx +394 -0
- package/src/react/ProgressDialog.tsx +185 -0
- package/src/react/types.ts +35 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<div id="error-overlay" class="custom-overlay hidden bg-gradient-to-br from-red-700 to-purple-700">
|
|
2
|
+
<div class="mb-5 text-5xl">⚠️</div>
|
|
3
|
+
<div class="font-semibold tracking-wide text-white/95 text-xl">No se pudo iniciar</div>
|
|
4
|
+
<div class="mt-3 max-w-[80%] text-center font-light text-white/75 text-sm">
|
|
5
|
+
Verifique los permisos de cámara o intente con otro dispositivo
|
|
6
|
+
</div>
|
|
7
|
+
<button
|
|
8
|
+
onclick="location.reload()"
|
|
9
|
+
class="mt-6 rounded-lg bg-blue-500 px-6 py-2.5 font-semibold text-white transition-all hover:bg-blue-600 hover:shadow-lg"
|
|
10
|
+
>
|
|
11
|
+
Reintentar
|
|
12
|
+
</button>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
#error-overlay {
|
|
17
|
+
background: linear-gradient(135deg, #c0392b, #8e44ad);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.error-icon {
|
|
21
|
+
font-size: 50px;
|
|
22
|
+
margin-bottom: 20px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.retry-button {
|
|
26
|
+
margin-top: 20px;
|
|
27
|
+
padding: 10px 20px;
|
|
28
|
+
background-color: #3498db;
|
|
29
|
+
color: white;
|
|
30
|
+
border: none;
|
|
31
|
+
border-radius: 5px;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
transition: background-color 0.3s ease;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.retry-button:hover {
|
|
38
|
+
background-color: #2980b9;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<div id="loading-overlay" class="custom-overlay bg-gradient-to-br from-gray-800 to-gray-900">
|
|
2
|
+
<div class="loader"></div>
|
|
3
|
+
<div class="mt-5 font-semibold tracking-wide text-white/95 text-xl">Preparando...</div>
|
|
4
|
+
<div class="mt-3 max-w-[80%] text-center font-light text-white/75 text-sm">
|
|
5
|
+
Un momento mientras optimizamos su experiencia
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<style>
|
|
10
|
+
.loader {
|
|
11
|
+
width: 60px;
|
|
12
|
+
height: 60px;
|
|
13
|
+
border: 5px solid rgba(255, 255, 255, 0.2);
|
|
14
|
+
border-top: 5px solid #3498db;
|
|
15
|
+
border-radius: 50%;
|
|
16
|
+
animation: spin 1s linear infinite;
|
|
17
|
+
margin-bottom: 20px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@keyframes spin {
|
|
21
|
+
0% {
|
|
22
|
+
transform: rotate(0deg);
|
|
23
|
+
}
|
|
24
|
+
100% {
|
|
25
|
+
transform: rotate(360deg);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
targetImage?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const { targetImage } = Astro.props;
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<div
|
|
10
|
+
id="scanning-overlay"
|
|
11
|
+
class="custom-overlay relative flex flex-col items-center justify-center"
|
|
12
|
+
>
|
|
13
|
+
<div class="scan-region relative mb-8 h-[300px] w-[300px] overflow-hidden">
|
|
14
|
+
<!-- Esquinas del recuadro de escaneo -->
|
|
15
|
+
<div class="corner top-left"></div>
|
|
16
|
+
<div class="corner top-right"></div>
|
|
17
|
+
<div class="corner bottom-left"></div>
|
|
18
|
+
<div class="corner bottom-right"></div>
|
|
19
|
+
|
|
20
|
+
<div class="absolute inset-0 p-6">
|
|
21
|
+
<img id="target-preview" src={targetImage} class="h-full w-full object-contain opacity-90" />
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="scan-animation"></div>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div class="font-semibold tracking-wide text-white/95 text-2xl">Escaneando...</div>
|
|
28
|
+
<div class="mt-3 max-w-[80%] text-center font-light text-white/75 text-sm">
|
|
29
|
+
Centre el sticker dentro del marco
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<style>
|
|
34
|
+
.scan-region img {
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
object-fit: contain;
|
|
38
|
+
opacity: 0.7;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.scan-animation {
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 2px;
|
|
47
|
+
background: linear-gradient(
|
|
48
|
+
90deg,
|
|
49
|
+
rgba(52, 152, 219, 0),
|
|
50
|
+
rgba(52, 152, 219, 0.8),
|
|
51
|
+
rgba(155, 89, 182, 0.8),
|
|
52
|
+
rgba(52, 152, 219, 0)
|
|
53
|
+
);
|
|
54
|
+
box-shadow:
|
|
55
|
+
0 0 10px rgba(52, 152, 219, 0.7),
|
|
56
|
+
0 0 20px rgba(155, 89, 182, 0.4);
|
|
57
|
+
animation: scan 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@keyframes scan {
|
|
61
|
+
0% {
|
|
62
|
+
transform: translateY(0);
|
|
63
|
+
opacity: 0.8;
|
|
64
|
+
}
|
|
65
|
+
15% {
|
|
66
|
+
opacity: 1;
|
|
67
|
+
}
|
|
68
|
+
50% {
|
|
69
|
+
transform: translateY(298px);
|
|
70
|
+
opacity: 1;
|
|
71
|
+
}
|
|
72
|
+
85% {
|
|
73
|
+
opacity: 0.8;
|
|
74
|
+
}
|
|
75
|
+
100% {
|
|
76
|
+
transform: translateY(0);
|
|
77
|
+
opacity: 0.8;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Estilos para las esquinas */
|
|
82
|
+
.corner {
|
|
83
|
+
position: absolute;
|
|
84
|
+
width: 24px;
|
|
85
|
+
height: 24px;
|
|
86
|
+
border-color: white;
|
|
87
|
+
border-style: solid;
|
|
88
|
+
opacity: 0.7;
|
|
89
|
+
z-index: 1;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.top-left {
|
|
93
|
+
top: 6px;
|
|
94
|
+
left: 6px;
|
|
95
|
+
border-width: 2px 0 0 2px;
|
|
96
|
+
border-top-left-radius: 6px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.top-right {
|
|
100
|
+
top: 6px;
|
|
101
|
+
right: 6px;
|
|
102
|
+
border-width: 2px 2px 0 0;
|
|
103
|
+
border-top-right-radius: 6px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.bottom-left {
|
|
107
|
+
bottom: 6px;
|
|
108
|
+
left: 6px;
|
|
109
|
+
border-width: 0 0 2px 2px;
|
|
110
|
+
border-bottom-left-radius: 6px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.bottom-right {
|
|
114
|
+
bottom: 6px;
|
|
115
|
+
right: 6px;
|
|
116
|
+
border-width: 0 2px 2px 0;
|
|
117
|
+
border-bottom-right-radius: 6px;
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<script is:inline>
|
|
2
|
+
// Lógica mejorada para reproducción de video
|
|
3
|
+
let started = false;
|
|
4
|
+
let playing = false;
|
|
5
|
+
|
|
6
|
+
window.addEventListener("click", async function () {
|
|
7
|
+
try {
|
|
8
|
+
let video = document.querySelector("#ar-video");
|
|
9
|
+
let avideo = document.querySelector("a-video");
|
|
10
|
+
|
|
11
|
+
if (!video || !avideo) {
|
|
12
|
+
console.error("Elementos de video no encontrados");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!started) {
|
|
17
|
+
await video.play();
|
|
18
|
+
avideo.setAttribute("opacity", 1);
|
|
19
|
+
started = true;
|
|
20
|
+
playing = true;
|
|
21
|
+
} else {
|
|
22
|
+
if (playing) {
|
|
23
|
+
video.pause();
|
|
24
|
+
playing = false;
|
|
25
|
+
} else {
|
|
26
|
+
await video.play();
|
|
27
|
+
playing = true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error("Error en la reproducción del video:", error);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<script is:inline>
|
|
37
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
38
|
+
const scene = document.querySelector("a-scene");
|
|
39
|
+
const errorOverlay = document.getElementById("error-overlay");
|
|
40
|
+
const scanningOverlay = document.getElementById("scanning-overlay");
|
|
41
|
+
const videoEl = document.querySelector("#ar-video");
|
|
42
|
+
const mainVideo = document.querySelector("#main-video");
|
|
43
|
+
const targetImage = document.querySelector("#target-image");
|
|
44
|
+
|
|
45
|
+
if (!scene || !errorOverlay || !scanningOverlay || !videoEl || !mainVideo || !targetImage) {
|
|
46
|
+
console.error("Elementos críticos no encontrados");
|
|
47
|
+
if (errorOverlay) errorOverlay.classList.remove("hidden");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Verificación de recursos
|
|
52
|
+
targetImage.addEventListener("error", () => {
|
|
53
|
+
console.error("Error al cargar la imagen objetivo");
|
|
54
|
+
errorOverlay.classList.remove("hidden");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
videoEl.addEventListener("error", () => {
|
|
58
|
+
console.error("Error al cargar el video");
|
|
59
|
+
errorOverlay.classList.remove("hidden");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Gestión mejorada de errores AR
|
|
63
|
+
scene.addEventListener("arError", (event) => {
|
|
64
|
+
console.error("Error AR:", event);
|
|
65
|
+
errorOverlay.classList.remove("hidden");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Verificar si MindAR está disponible
|
|
69
|
+
if (!window.MINDAR || !window.MINDAR.IMAGE) {
|
|
70
|
+
console.error("MindAR no está disponible");
|
|
71
|
+
errorOverlay.classList.remove("hidden");
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Manejo de eventos de target
|
|
76
|
+
const targetEntity = document.querySelector("a-entity[mindar-image-target]");
|
|
77
|
+
|
|
78
|
+
targetEntity.addEventListener("targetFound", () => {
|
|
79
|
+
console.log("¡Objetivo encontrado!");
|
|
80
|
+
scanningOverlay.classList.add("hidden");
|
|
81
|
+
|
|
82
|
+
// Hacer visible el video
|
|
83
|
+
mainVideo.setAttribute("opacity", "1");
|
|
84
|
+
|
|
85
|
+
// Intentar reproducir
|
|
86
|
+
videoEl.play().catch((err) => {
|
|
87
|
+
console.error("Error reproduciendo video:", err);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
targetEntity.addEventListener("targetLost", () => {
|
|
92
|
+
console.log("Objetivo perdido");
|
|
93
|
+
scanningOverlay.classList.remove("hidden");
|
|
94
|
+
mainVideo.setAttribute("opacity", "0");
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Función para aplicar estilos adaptativos
|
|
98
|
+
function applyVideoStyles() {
|
|
99
|
+
// Estilos del elemento video HTML
|
|
100
|
+
if (videoEl) {
|
|
101
|
+
videoEl.style.width = "100%";
|
|
102
|
+
videoEl.style.height = "100%";
|
|
103
|
+
videoEl.style.objectFit = "contain";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Aplicar estilos al inicio y cuando cambie la orientación
|
|
108
|
+
applyVideoStyles();
|
|
109
|
+
window.addEventListener("resize", applyVideoStyles);
|
|
110
|
+
|
|
111
|
+
// Manejar toques para dispositivos móviles
|
|
112
|
+
document.addEventListener("touchstart", () => {
|
|
113
|
+
if (videoEl.paused && mainVideo.getAttribute("opacity") === "1") {
|
|
114
|
+
videoEl.play().catch((e) => console.log("Error en touchstart:", e));
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
</script>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<style is:global>
|
|
2
|
+
/* Estilos globales básicos de A-Frame */
|
|
3
|
+
.a-enter-vr,
|
|
4
|
+
.a-enter-vr-button {
|
|
5
|
+
display: none !important;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
body,
|
|
9
|
+
a-scene {
|
|
10
|
+
background-color: transparent !important;
|
|
11
|
+
font-family: "Montserrat", sans-serif;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.a-canvas {
|
|
15
|
+
background-color: transparent !important;
|
|
16
|
+
width: 100% !important;
|
|
17
|
+
height: 100% !important;
|
|
18
|
+
position: absolute !important;
|
|
19
|
+
top: 0 !important;
|
|
20
|
+
left: 0 !important;
|
|
21
|
+
right: 0 !important;
|
|
22
|
+
bottom: 0 !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Clase base compartida para overlays */
|
|
26
|
+
.custom-overlay {
|
|
27
|
+
position: fixed;
|
|
28
|
+
top: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-items: center;
|
|
36
|
+
z-index: 999;
|
|
37
|
+
color: white;
|
|
38
|
+
text-align: center;
|
|
39
|
+
transition: opacity 0.5s ease;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.custom-overlay.hidden {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Texto compartido */
|
|
47
|
+
.status-text {
|
|
48
|
+
font-size: 18px;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
margin-top: 20px;
|
|
51
|
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.instruction-text {
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
max-width: 80%;
|
|
57
|
+
margin-top: 10px;
|
|
58
|
+
opacity: 0.8;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Estilos para las pantallas de UI personalizadas */
|
|
62
|
+
.custom-overlay {
|
|
63
|
+
position: fixed;
|
|
64
|
+
top: 0;
|
|
65
|
+
left: 0;
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100%;
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
align-items: center;
|
|
72
|
+
z-index: 999;
|
|
73
|
+
background-color: rgba(0, 0, 0, 0);
|
|
74
|
+
color: white;
|
|
75
|
+
text-align: center;
|
|
76
|
+
transition: opacity 0.5s ease;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.custom-overlay.hidden {
|
|
80
|
+
display: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Pantalla de carga */
|
|
84
|
+
#loading-overlay {
|
|
85
|
+
background: linear-gradient(135deg, #2c3e50, #1a1a2e);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.loader {
|
|
89
|
+
width: 60px;
|
|
90
|
+
height: 60px;
|
|
91
|
+
border: 5px solid rgba(255, 255, 255, 0.2);
|
|
92
|
+
border-top: 5px solid #3498db;
|
|
93
|
+
border-radius: 50%;
|
|
94
|
+
animation: spin 1s linear infinite;
|
|
95
|
+
margin-bottom: 20px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@keyframes spin {
|
|
99
|
+
0% {
|
|
100
|
+
transform: rotate(0deg);
|
|
101
|
+
}
|
|
102
|
+
100% {
|
|
103
|
+
transform: rotate(360deg);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Pantalla de error */
|
|
108
|
+
#error-overlay {
|
|
109
|
+
background: linear-gradient(135deg, #c0392b, #8e44ad);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.error-icon {
|
|
113
|
+
font-size: 50px;
|
|
114
|
+
margin-bottom: 20px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Pantalla de escaneo */
|
|
118
|
+
#scanning-overlay {
|
|
119
|
+
background-color: rgba(0, 0, 0, 0);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* Botón para reintentar */
|
|
123
|
+
.retry-button {
|
|
124
|
+
margin-top: 20px;
|
|
125
|
+
padding: 10px 20px;
|
|
126
|
+
background-color: #3498db;
|
|
127
|
+
color: white;
|
|
128
|
+
border: none;
|
|
129
|
+
border-radius: 5px;
|
|
130
|
+
font-weight: 600;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
transition: background-color 0.3s ease;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.retry-button:hover {
|
|
136
|
+
background-color: #2980b9;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
video {
|
|
140
|
+
width: 100% !important;
|
|
141
|
+
height: 100% !important;
|
|
142
|
+
object-fit: cover !important;
|
|
143
|
+
position: absolute !important;
|
|
144
|
+
top: 0 !important;
|
|
145
|
+
left: 0 !important;
|
|
146
|
+
}
|
|
147
|
+
</style>
|