@srsergio/taptapp-ar 1.0.64 β 1.0.69
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 +79 -105
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/dist/react/types.d.ts +2 -5
- package/dist/react/types.js +5 -7
- package/package.json +5 -20
- package/src/index.ts +1 -4
- package/src/react/types.ts +7 -12
package/README.md
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
# @srsergio/taptapp-ar
|
|
2
2
|
|
|
3
|
-
<p align="center">
|
|
4
|
-
<a href="./docs/technical-paper.pdf">π <b>Technical Paper (PDF)</b></a> |
|
|
5
|
-
<a href="./docs/index.html">π <b>Official Website</b></a> |
|
|
6
|
-
<a href="./analysis/INDEX.md">π <b>Analysis Report</b></a>
|
|
7
|
-
</p>
|
|
8
|
-
|
|
9
3
|
π **TapTapp AR** is a high-performance Augmented Reality (AR) toolkit for **Node.js** and **Browser** environments. It provides an ultra-fast offline compiler and a lightweight runtime for image tracking.
|
|
10
4
|
|
|
11
5
|
**100% Pure JavaScript**: This package is now completely independent of **TensorFlow.js** for both compilation and real-time tracking, resulting in massive performance gains and zero-latency initialization.
|
|
@@ -83,104 +77,43 @@ const binaryBuffer = compiler.exportData();
|
|
|
83
77
|
|
|
84
78
|
## π₯ Runtime Usage (AR Tracking)
|
|
85
79
|
|
|
86
|
-
### 1.
|
|
87
|
-
The
|
|
88
|
-
|
|
89
|
-
```javascript
|
|
90
|
-
import { SimpleAR } from '@srsergio/taptapp-ar';
|
|
80
|
+
### 1. Simple A-Frame Integration
|
|
81
|
+
The easiest way to use TapTapp AR in a web app:
|
|
91
82
|
|
|
92
|
-
const ar = new SimpleAR({
|
|
93
|
-
container: document.getElementById('ar-container'),
|
|
94
|
-
targetSrc: './my-target.taar', // Single URL or array: ['./a.taar', './b.taar']
|
|
95
|
-
overlay: document.getElementById('my-overlay'),
|
|
96
|
-
onFound: ({ targetIndex }) => console.log(`Target ${targetIndex} detected! π―`),
|
|
97
|
-
onLost: ({ targetIndex }) => console.log(`Target ${targetIndex} lost π`)
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
await ar.start();
|
|
101
|
-
|
|
102
|
-
// When done:
|
|
103
|
-
ar.stop();
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
#### π Minimal HTML Example
|
|
107
83
|
```html
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
container: document.getElementById('ar-container'),
|
|
118
|
-
targetSrc: './targets.taar',
|
|
119
|
-
overlay: document.getElementById('my-overlay'),
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
ar.start();
|
|
123
|
-
</script>
|
|
84
|
+
<script src="https://aframe.io/releases/1.5.0/aframe.min.js"></script>
|
|
85
|
+
<script src="path/to/@srsergio/taptapp-ar/dist/index.js"></script>
|
|
86
|
+
|
|
87
|
+
<a-scene taar-image="imageTargetSrc: ./targets.taar;">
|
|
88
|
+
<a-camera position="0 0 0" look-controls="enabled: false"></a-camera>
|
|
89
|
+
<a-entity taar-image-target="targetIndex: 0">
|
|
90
|
+
<a-plane position="0 0 0" height="0.552" width="1"></a-plane>
|
|
91
|
+
</a-entity>
|
|
92
|
+
</a-scene>
|
|
124
93
|
```
|
|
125
94
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
| :--- | :--- | :--- |
|
|
129
|
-
| `container` | β
| DOM element where video + overlay render |
|
|
130
|
-
| `targetSrc` | β
| URL to your `.taar` file |
|
|
131
|
-
| `overlay` | β
| DOM element to position on the target |
|
|
132
|
-
| `onFound` | β | Callback when target is detected |
|
|
133
|
-
| `onLost` | β | Callback when target is lost |
|
|
134
|
-
| `onUpdate` | β | Called cada frame con `{ targetIndex, worldMatrix }` |
|
|
135
|
-
| `cameraConfig` | β | Config de cΓ‘mara (por defecto: `{ facingMode: 'environment', width: 1280, height: 720 }`) |
|
|
136
|
-
|
|
137
|
-
---
|
|
95
|
+
### 2. High-Performance Three.js Wrapper
|
|
96
|
+
For custom Three.js applications:
|
|
138
97
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
The fastest and most modern way to build AR apps with React. It supports **Code Splitting** and is **100% SSR-Safe** (Next.js, Astro, Remix).
|
|
142
|
-
|
|
143
|
-
#### π Quick Start: `<TaptappAR />`
|
|
144
|
-
Drop the component into your app. It handles camera permissions, scanning animations, and video/image overlays automatically.
|
|
98
|
+
```javascript
|
|
99
|
+
import { TaarThree } from '@srsergio/taptapp-ar';
|
|
145
100
|
|
|
146
|
-
|
|
147
|
-
|
|
101
|
+
const taarThree = new TaarThree({
|
|
102
|
+
container: document.querySelector("#container"),
|
|
103
|
+
imageTargetSrc: './targets.taar',
|
|
104
|
+
});
|
|
148
105
|
|
|
149
|
-
const
|
|
150
|
-
// Use mapDataToPropsConfig to convert your raw data into ARConfig
|
|
151
|
-
const config = mapDataToPropsConfig(data);
|
|
106
|
+
const {renderer, scene, camera} = taarThree;
|
|
152
107
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
<TaptappAR config={config} />
|
|
156
|
-
</div>
|
|
157
|
-
);
|
|
158
|
-
};
|
|
159
|
-
```
|
|
108
|
+
const anchor = taarThree.addAnchor(0);
|
|
109
|
+
// Add your 3D models to anchor.group
|
|
160
110
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
import { useAR } from '@srsergio/taptapp-ar';
|
|
166
|
-
|
|
167
|
-
const CustomAR = ({ config }) => {
|
|
168
|
-
const { containerRef, overlayRef, status, toggleVideo } = useAR(config);
|
|
169
|
-
|
|
170
|
-
return (
|
|
171
|
-
<div ref={containerRef} style={{ position: 'relative' }} onClick={toggleVideo}>
|
|
172
|
-
{/* Custom Scanning UI */}
|
|
173
|
-
{status === 'scanning' && <div className="my-loader">Scanning...</div>}
|
|
174
|
-
|
|
175
|
-
{/* Video Overlay */}
|
|
176
|
-
<video ref={overlayRef} src={config.videoSrc} loop muted playsInline />
|
|
177
|
-
</div>
|
|
178
|
-
);
|
|
179
|
-
};
|
|
111
|
+
await taarThree.start();
|
|
112
|
+
renderer.setAnimationLoop(() => {
|
|
113
|
+
renderer.render(scene, camera);
|
|
114
|
+
});
|
|
180
115
|
```
|
|
181
116
|
|
|
182
|
-
---
|
|
183
|
-
|
|
184
117
|
### 3. Raw Controller (Advanced & Custom Engines)
|
|
185
118
|
The `Controller` is the core engine of TapTapp AR. You can use it to build your own AR components or integrate tracking into custom 3D engines.
|
|
186
119
|
|
|
@@ -246,8 +179,56 @@ if (targetIndex !== -1) {
|
|
|
246
179
|
}
|
|
247
180
|
```
|
|
248
181
|
|
|
249
|
-
###
|
|
250
|
-
|
|
182
|
+
### 4. Vanilla JS (No Framework) π¦
|
|
183
|
+
The **simplest way** to use ARβno Three.js, no A-Frame. Just overlay an image on the tracked target.
|
|
184
|
+
|
|
185
|
+
```javascript
|
|
186
|
+
import { SimpleAR } from '@srsergio/taptapp-ar';
|
|
187
|
+
|
|
188
|
+
const ar = new SimpleAR({
|
|
189
|
+
container: document.getElementById('ar-container'),
|
|
190
|
+
targetSrc: './my-target.taar', // Single URL or array: ['./a.taar', './b.taar']
|
|
191
|
+
overlay: document.getElementById('my-overlay'),
|
|
192
|
+
onFound: ({ targetIndex }) => console.log(`Target ${targetIndex} detected! π―`),
|
|
193
|
+
onLost: ({ targetIndex }) => console.log(`Target ${targetIndex} lost π`)
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
await ar.start();
|
|
197
|
+
|
|
198
|
+
// When done:
|
|
199
|
+
ar.stop();
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### π Minimal HTML
|
|
203
|
+
```html
|
|
204
|
+
<div id="ar-container" style="width: 100vw; height: 100vh;">
|
|
205
|
+
<img id="my-overlay" src="./overlay.png"
|
|
206
|
+
style="opacity: 0; z-index: 1; width: 200px; transition: opacity 0.3s;" />
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<script type="module">
|
|
210
|
+
import { SimpleAR } from '@srsergio/taptapp-ar';
|
|
211
|
+
|
|
212
|
+
const ar = new SimpleAR({
|
|
213
|
+
container: document.getElementById('ar-container'),
|
|
214
|
+
targetSrc: './targets.taar',
|
|
215
|
+
overlay: document.getElementById('my-overlay'),
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
ar.start();
|
|
219
|
+
</script>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
#### βοΈ SimpleAR Options
|
|
223
|
+
| Option | Required | Description |
|
|
224
|
+
| :--- | :--- | :--- |
|
|
225
|
+
| `container` | β
| DOM element where video + overlay render |
|
|
226
|
+
| `targetSrc` | β
| URL to your `.taar` file |
|
|
227
|
+
| `overlay` | β
| DOM element to position on the target |
|
|
228
|
+
| `onFound` | β | Callback when target is detected |
|
|
229
|
+
| `onLost` | β | Callback when target is lost |
|
|
230
|
+
| `onUpdate` | β | Called each frame with `{ targetIndex, worldMatrix }` |
|
|
231
|
+
| `cameraConfig` | β | Camera constraints (default: `{ facingMode: 'environment', width: 1280, height: 720 }`) |
|
|
251
232
|
|
|
252
233
|
---
|
|
253
234
|
|
|
@@ -261,15 +242,8 @@ TapTapp AR uses a proprietary **Moonshot Vision Codec** that is significantly mo
|
|
|
261
242
|
|
|
262
243
|
---
|
|
263
244
|
|
|
264
|
-
## π License &
|
|
265
|
-
|
|
266
|
-
**Taptapp AR** is created and maintained by **Sergio Lazaro**.
|
|
267
|
-
|
|
268
|
-
This project is licensed under the **GPL-3.0 License**.
|
|
269
|
-
This ensures that the project remains open and free, and that authorship is properly recognized. No "closed-source" usage is allowed without a commercial agreement.
|
|
270
|
-
|
|
271
|
-
Commercial licenses are available for proprietary applications. Please contact the author for details.
|
|
245
|
+
## π License & Credits
|
|
272
246
|
|
|
273
|
-
|
|
274
|
-
This project evolved from the incredible work of [MindAR](https://github.com/hiukim/mind-ar-js). While the codebase has been extensively rewritten and optimized for performance, we gratefully acknowledge the foundation laid by the original authors.
|
|
247
|
+
MIT Β© [srsergiolazaro](https://github.com/srsergiolazaro)
|
|
275
248
|
|
|
249
|
+
Based on the core research of MindAR, but completely re-written for high-performance binary processing and JS-only execution.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./react/use-ar.js";
|
|
3
|
-
export * from "./react/TaptappAR.js";
|
|
1
|
+
export * from "./react/types.js";
|
|
4
2
|
export * from "./compiler/offline-compiler.js";
|
|
5
3
|
export { Controller } from "./compiler/controller.js";
|
|
6
4
|
export { SimpleAR } from "./compiler/simple-ar.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./react/use-ar.js";
|
|
3
|
-
export * from "./react/TaptappAR.js";
|
|
1
|
+
export * from "./react/types.js";
|
|
4
2
|
export * from "./compiler/offline-compiler.js";
|
|
5
3
|
export { Controller } from "./compiler/controller.js";
|
|
6
4
|
export { SimpleAR } from "./compiler/simple-ar.js";
|
package/dist/react/types.d.ts
CHANGED
|
@@ -3,23 +3,20 @@ export interface ARConfig {
|
|
|
3
3
|
targetImageSrc: string;
|
|
4
4
|
targetTaarSrc: string;
|
|
5
5
|
videoSrc: string;
|
|
6
|
-
overlaySrc: string;
|
|
7
6
|
videoWidth: number;
|
|
8
7
|
videoHeight: number;
|
|
9
8
|
scale: number;
|
|
10
|
-
overlayType: "video" | "image";
|
|
11
9
|
}
|
|
12
10
|
export interface ARDataItem {
|
|
13
11
|
id: string;
|
|
14
|
-
type: "photos" | "videoNative" | "ar"
|
|
12
|
+
type: "photos" | "videoNative" | "ar";
|
|
15
13
|
images?: {
|
|
16
14
|
image: string;
|
|
17
15
|
fileId: string;
|
|
18
16
|
}[];
|
|
19
17
|
url?: string;
|
|
20
|
-
fileId?: string;
|
|
21
18
|
scale?: number;
|
|
22
19
|
width?: number;
|
|
23
20
|
height?: number;
|
|
24
21
|
}
|
|
25
|
-
export declare function mapDataToPropsConfig(data:
|
|
22
|
+
export declare function mapDataToPropsConfig(data: any[]): ARConfig;
|
package/dist/react/types.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
export function mapDataToPropsConfig(data) {
|
|
2
2
|
const photos = data.find((item) => item.type === "photos");
|
|
3
|
-
const
|
|
3
|
+
const video = data.find((item) => item.type === "videoNative");
|
|
4
4
|
const ar = data.find((item) => item.type === "ar");
|
|
5
5
|
return {
|
|
6
6
|
cardId: photos?.id || "",
|
|
7
7
|
targetImageSrc: photos?.images?.[0]?.image || "",
|
|
8
8
|
targetTaarSrc: ar?.url || "",
|
|
9
|
-
videoSrc:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
scale: overlay?.scale || 1,
|
|
14
|
-
overlayType: overlay?.type === "videoNative" ? "video" : "image",
|
|
9
|
+
videoSrc: video?.url || "",
|
|
10
|
+
videoWidth: video?.width || 0,
|
|
11
|
+
videoHeight: video?.height || 0,
|
|
12
|
+
scale: video?.scale || 1,
|
|
15
13
|
};
|
|
16
14
|
}
|
package/package.json
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srsergio/taptapp-ar",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"
|
|
5
|
-
"license": "GPL-3.0",
|
|
6
|
-
"description": "Ultra-fast, lightweight Augmented Reality Image Tracking SDK for the web. Features an optimized offline compiler, React components, and compatibility with Three.js/A-Frame. No heavy ML frameworks required.",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"web-ar",
|
|
9
|
-
"augmented-reality",
|
|
10
|
-
"image-tracking",
|
|
11
|
-
"ar-compiler",
|
|
12
|
-
"computer-vision",
|
|
13
|
-
"three-js",
|
|
14
|
-
"react-ar",
|
|
15
|
-
"a-frame",
|
|
16
|
-
"mind-ar",
|
|
17
|
-
"offline-ar",
|
|
18
|
-
"webgl",
|
|
19
|
-
"markerless-tracking",
|
|
20
|
-
"taptapp"
|
|
21
|
-
],
|
|
3
|
+
"version": "1.0.69",
|
|
4
|
+
"description": "AR Compiler for Node.js and Browser",
|
|
22
5
|
"repository": {
|
|
23
6
|
"type": "git",
|
|
24
7
|
"url": "git+https://github.com/srsergiolazaro/taptapp-ar.git"
|
|
@@ -74,11 +57,13 @@
|
|
|
74
57
|
"tinyqueue": "^2.0.3"
|
|
75
58
|
},
|
|
76
59
|
"devDependencies": {
|
|
77
|
-
"@types/node": "^
|
|
60
|
+
"@types/node": "^20.14.2",
|
|
78
61
|
"@types/react": "^18.3.3",
|
|
79
62
|
"@types/react-dom": "^18.3.0",
|
|
80
63
|
"@types/three": "^0.170.0",
|
|
81
64
|
"jimp": "^1.6.0",
|
|
65
|
+
"react": "^18.3.1",
|
|
66
|
+
"react-dom": "^18.3.1",
|
|
82
67
|
"typescript": "^5.4.5",
|
|
83
68
|
"vitest": "^4.0.16"
|
|
84
69
|
},
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./react/use-ar.js";
|
|
3
|
-
export * from "./react/TaptappAR.js";
|
|
1
|
+
export * from "./react/types.js";
|
|
4
2
|
export * from "./compiler/offline-compiler.js";
|
|
5
3
|
export { Controller } from "./compiler/controller.js";
|
|
6
4
|
export { SimpleAR } from "./compiler/simple-ar.js";
|
|
7
|
-
|
package/src/react/types.ts
CHANGED
|
@@ -3,38 +3,33 @@ export interface ARConfig {
|
|
|
3
3
|
targetImageSrc: string;
|
|
4
4
|
targetTaarSrc: string;
|
|
5
5
|
videoSrc: string;
|
|
6
|
-
overlaySrc: string; // Alias for preloading/compatibility
|
|
7
6
|
videoWidth: number;
|
|
8
7
|
videoHeight: number;
|
|
9
8
|
scale: number;
|
|
10
|
-
overlayType: "video" | "image";
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
export interface ARDataItem {
|
|
14
12
|
id: string;
|
|
15
|
-
type: "photos" | "videoNative" | "ar"
|
|
13
|
+
type: "photos" | "videoNative" | "ar";
|
|
16
14
|
images?: { image: string; fileId: string }[];
|
|
17
15
|
url?: string;
|
|
18
|
-
fileId?: string;
|
|
19
16
|
scale?: number;
|
|
20
17
|
width?: number;
|
|
21
18
|
height?: number;
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
export function mapDataToPropsConfig(data:
|
|
21
|
+
export function mapDataToPropsConfig(data: any[]): ARConfig {
|
|
25
22
|
const photos = data.find((item) => item.type === "photos");
|
|
26
|
-
const
|
|
23
|
+
const video = data.find((item) => item.type === "videoNative");
|
|
27
24
|
const ar = data.find((item) => item.type === "ar");
|
|
28
25
|
|
|
29
26
|
return {
|
|
30
27
|
cardId: photos?.id || "",
|
|
31
28
|
targetImageSrc: photos?.images?.[0]?.image || "",
|
|
32
29
|
targetTaarSrc: ar?.url || "",
|
|
33
|
-
videoSrc:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
scale: overlay?.scale || 1,
|
|
38
|
-
overlayType: overlay?.type === "videoNative" ? "video" : "image",
|
|
30
|
+
videoSrc: video?.url || "",
|
|
31
|
+
videoWidth: video?.width || 0,
|
|
32
|
+
videoHeight: video?.height || 0,
|
|
33
|
+
scale: video?.scale || 1,
|
|
39
34
|
};
|
|
40
35
|
}
|