@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 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> &nbsp;|&nbsp;
5
- <a href="./docs/index.html">🌐 <b>Official Website</b></a> &nbsp;|&nbsp;
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. SimpleAR (Recommended) 🍦
87
- The **simplest way** to use ARβ€”no Three.js or A-Frame required. Just overlay an HTML element on the tracked target.
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
- <div id="ar-container" style="width: 100vw; height: 100vh;">
109
- <img id="my-overlay" src="./overlay.png"
110
- style="opacity: 0; z-index: 1; width: 200px; transition: opacity 0.3s;" />
111
- </div>
112
-
113
- <script type="module">
114
- import { SimpleAR } from '@srsergio/taptapp-ar';
115
-
116
- const ar = new SimpleAR({
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
- #### βš™οΈ SimpleAR Options
127
- | Option | Required | Description |
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
- ### 2. React Integration (Vite & SSR Safe) βš›οΈ
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
- ```tsx
147
- import { TaptappAR, mapDataToPropsConfig } from '@srsergio/taptapp-ar';
101
+ const taarThree = new TaarThree({
102
+ container: document.querySelector("#container"),
103
+ imageTargetSrc: './targets.taar',
104
+ });
148
105
 
149
- const MyARComponent = ({ data }) => {
150
- // Use mapDataToPropsConfig to convert your raw data into ARConfig
151
- const config = mapDataToPropsConfig(data);
106
+ const {renderer, scene, camera} = taarThree;
152
107
 
153
- return (
154
- <div style={{ width: '100vw', height: '100vh' }}>
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
- #### πŸ› οΈ Custom UI: `useAR()` Hook
162
- If you want to build your own UI while keeping the powerful tracking logic:
163
-
164
- ```tsx
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
- ### πŸ“š Legacy Usage
250
- For **A-Frame** or **Three.js** wrappers, please refer to the [Advanced Usage Documentation](./docs/advanced-usage.md).
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 & Recognition
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
- ### Acknowledgements
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 { ARConfig, ARDataItem, mapDataToPropsConfig } from "./react/types.js";
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 { mapDataToPropsConfig } from "./react/types.js";
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";
@@ -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" | "imageOverlay";
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: ARDataItem[]): ARConfig;
22
+ export declare function mapDataToPropsConfig(data: any[]): ARConfig;
@@ -1,16 +1,14 @@
1
1
  export function mapDataToPropsConfig(data) {
2
2
  const photos = data.find((item) => item.type === "photos");
3
- const overlay = data.find((item) => item.type === "videoNative" || item.type === "imageOverlay");
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: overlay?.url || "",
10
- overlaySrc: overlay?.url || "",
11
- videoWidth: overlay?.width || 0,
12
- videoHeight: overlay?.height || 0,
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.64",
4
- "author": "Sergio Lazaro <srsergiolazaro@gmail.com>",
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": "^25.0.3",
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 { ARConfig, ARDataItem, mapDataToPropsConfig } from "./react/types.js";
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
-
@@ -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" | "imageOverlay";
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: ARDataItem[]): ARConfig {
21
+ export function mapDataToPropsConfig(data: any[]): ARConfig {
25
22
  const photos = data.find((item) => item.type === "photos");
26
- const overlay = data.find((item) => item.type === "videoNative" || item.type === "imageOverlay");
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: overlay?.url || "",
34
- overlaySrc: overlay?.url || "",
35
- videoWidth: overlay?.width || 0,
36
- videoHeight: overlay?.height || 0,
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
  }