@srsergio/taptapp-ar 1.0.98 → 1.0.100
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/LICENSE +12 -3
- package/README.md +92 -13
- package/dist/react/types.d.ts +1 -0
- package/dist/react/use-ar.js +2 -1
- package/package.json +2 -2
- package/src/react/types.ts +1 -0
- package/src/react/use-ar.ts +2 -1
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
Fair Source License v0.9
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2026 Sergio Lázaro
|
|
4
4
|
|
|
@@ -9,8 +9,16 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
|
10
10
|
furnished to do so, subject to the following conditions:
|
|
11
11
|
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
copies or substantial portions of the Software.
|
|
12
|
+
1. The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
2. A "Large Entity" (defined below) must obtain a separate commercial license
|
|
16
|
+
from the copyright holder before using the Software in any commercial
|
|
17
|
+
context.
|
|
18
|
+
|
|
19
|
+
3. "Large Entity" means any organization or individual that:
|
|
20
|
+
a. Has 100 or more employees; or
|
|
21
|
+
b. Has $10,000,000 USD or more in annual revenue.
|
|
14
22
|
|
|
15
23
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
24
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
@@ -19,3 +27,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
27
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
28
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
29
|
SOFTWARE.
|
|
30
|
+
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@srsergio/taptapp-ar)
|
|
4
4
|
[](https://www.npmjs.com/package/@srsergio/taptapp-ar)
|
|
5
|
-
[](./LICENSE)
|
|
6
6
|
[](https://bundlephobia.com/package/@srsergio/taptapp-ar)
|
|
7
7
|
|
|
8
8
|
🚀 **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.
|
|
@@ -123,32 +123,101 @@ export const MyARScene = () => (
|
|
|
123
123
|
);
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
### 2.
|
|
126
|
+
### 2. High-Performance React Hook: `useAR` 🪝
|
|
127
127
|
|
|
128
|
-
For
|
|
128
|
+
For more control over the AR state or custom UI overlays:
|
|
129
129
|
|
|
130
|
-
```
|
|
131
|
-
import {
|
|
130
|
+
```tsx
|
|
131
|
+
import { useAR } from '@srsergio/taptapp-ar/react';
|
|
132
|
+
|
|
133
|
+
const MyCustomAR = () => {
|
|
134
|
+
const {
|
|
135
|
+
containerRef,
|
|
136
|
+
overlayRef,
|
|
137
|
+
status,
|
|
138
|
+
trackedPoints,
|
|
139
|
+
error
|
|
140
|
+
} = useAR({
|
|
141
|
+
targetImageSrc: "target.png",
|
|
142
|
+
scale: 1.0
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<div ref={containerRef} style={{ width: '100%', height: '100vh' }}>
|
|
147
|
+
{/* Your custom 3D or 2D overlay */}
|
|
148
|
+
<video ref={overlayRef} src="content.mp4" />
|
|
149
|
+
|
|
150
|
+
{/* Use trackedPoints for custom visualizations */}
|
|
151
|
+
{trackedPoints.map((p, i) => (
|
|
152
|
+
<div key={i} style={{ position: 'absolute', left: p.x, top: p.y }} />
|
|
153
|
+
))}
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 3. Native API: `startTracking`
|
|
160
|
+
|
|
161
|
+
For vanilla JS or custom integrations:
|
|
132
162
|
|
|
163
|
+
```typescript
|
|
133
164
|
const tracker = await startTracking({
|
|
134
|
-
targetSrc: './assets/target.jpg',
|
|
165
|
+
targetSrc: './assets/target.jpg',
|
|
135
166
|
container: document.getElementById('ar-container'),
|
|
136
167
|
overlay: document.getElementById('overlay-element'),
|
|
137
168
|
|
|
138
|
-
//
|
|
169
|
+
// 📸 Custom Camera Config
|
|
170
|
+
cameraConfig: {
|
|
171
|
+
facingMode: 'environment', // Use back camera
|
|
172
|
+
width: { ideal: 1920 }, // Request Full HD
|
|
173
|
+
height: { ideal: 1080 }
|
|
174
|
+
},
|
|
175
|
+
|
|
139
176
|
callbacks: {
|
|
140
|
-
onFound: () => console.log("Target Found!
|
|
141
|
-
onLost: () => console.log("Target Lost 👋"),
|
|
177
|
+
onFound: () => console.log("Target Found!"),
|
|
142
178
|
onUpdate: (data) => {
|
|
143
|
-
console.log(
|
|
179
|
+
console.log(`Stability: ${data.avgStability}`);
|
|
144
180
|
}
|
|
145
181
|
}
|
|
146
182
|
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### 4. Custom Overlays (Beyond Video/Images) 🧩
|
|
147
186
|
|
|
148
|
-
|
|
149
|
-
|
|
187
|
+
The `overlay` isn't limited to images or videos. You can use **any HTML element** (divs, buttons, canvas, etc.). The engine will apply the transformation matrix automatically to align it with the target.
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
// Using an interactive HTML overlay in React
|
|
191
|
+
const InteractiveAR = () => {
|
|
192
|
+
const { containerRef, overlayRef, status } = useAR({
|
|
193
|
+
targetImageSrc: "map.jpg",
|
|
194
|
+
scale: 1.0
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<div ref={containerRef}>
|
|
199
|
+
{/* 🚀 This div will be pinned and skewed to the physical target */}
|
|
200
|
+
<div
|
|
201
|
+
ref={overlayRef as any}
|
|
202
|
+
style={{ background: 'white', padding: '10px', borderRadius: '8px' }}
|
|
203
|
+
>
|
|
204
|
+
<h4>Dynamic UI</h4>
|
|
205
|
+
<button onClick={() => alert('Clicked!')}>Interacción AR</button>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
);
|
|
209
|
+
};
|
|
150
210
|
```
|
|
151
211
|
|
|
212
|
+
#### `TrackingUpdate` Data Object
|
|
213
|
+
The `onUpdate` callback provides a rich data object:
|
|
214
|
+
- `isTracking`: Boolean status.
|
|
215
|
+
- `avgReliability`: (0-1) Confidence of the match.
|
|
216
|
+
- `avgStability`: (0-1) Movement smoothness.
|
|
217
|
+
- `screenCoords`: Array of `{x, y, id}` of tracked points.
|
|
218
|
+
- `worldMatrix`: 4x4 matrix for WebGL/Three.js integration.
|
|
219
|
+
- `targetDimensions`: `[width, height]` of the source target.
|
|
220
|
+
|
|
152
221
|
### 3. Advanced Integration (Three.js / A-Frame)
|
|
153
222
|
|
|
154
223
|
We still provide wrappers for 3D engines if you need to render complex 3D models instead of DOM overlays.
|
|
@@ -178,7 +247,17 @@ TapTapp AR uses a proprietary **Nanite-style Vision Codec** that is significantl
|
|
|
178
247
|
|
|
179
248
|
## 📄 License & Credits
|
|
180
249
|
|
|
250
|
+
This project is licensed under the **Fair Source License v0.9**.
|
|
251
|
+
|
|
252
|
+
### What does this mean?
|
|
253
|
+
- **Small Entities & Individuals**: You can use, modify, and distribute this software for **FREE** (including commercial use).
|
|
254
|
+
- **Large Entities**: If your organization has **100+ employees** OR **$10,000,000+ USD in annual revenue**, you must obtain a separate commercial license from the copyright holder before using it in a commercial context.
|
|
255
|
+
|
|
256
|
+
This model allows us to keep the project open and free for the community while ensuring sustainability from large-scale corporate usage.
|
|
257
|
+
|
|
258
|
+
---
|
|
181
259
|
MIT © [srsergiolazaro](https://github.com/srsergiolazaro)
|
|
182
260
|
|
|
183
|
-
Based on
|
|
261
|
+
Based on core research from the community, but completely re-written for high-performance binary processing and JS-only execution.
|
|
262
|
+
|
|
184
263
|
|
package/dist/react/types.d.ts
CHANGED
package/dist/react/use-ar.js
CHANGED
|
@@ -41,6 +41,7 @@ export const useAR = (config) => {
|
|
|
41
41
|
targetSrc: config.targetTaarSrc || config.targetImageSrc,
|
|
42
42
|
overlay: overlayRef.current,
|
|
43
43
|
scale: config.scale,
|
|
44
|
+
cameraConfig: config.cameraConfig,
|
|
44
45
|
debugMode: false,
|
|
45
46
|
callbacks: {
|
|
46
47
|
onUpdate: (data) => {
|
|
@@ -104,7 +105,7 @@ export const useAR = (config) => {
|
|
|
104
105
|
arInstanceRef.current?.stop();
|
|
105
106
|
arInstanceRef.current = null;
|
|
106
107
|
};
|
|
107
|
-
}, [config.targetTaarSrc, config.targetImageSrc, config.scale]);
|
|
108
|
+
}, [config.targetTaarSrc, config.targetImageSrc, config.scale, config.cameraConfig]);
|
|
108
109
|
return {
|
|
109
110
|
containerRef,
|
|
110
111
|
overlayRef,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srsergio/taptapp-ar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.100",
|
|
4
4
|
"description": "Ultra-fast Augmented Reality (AR) SDK for Node.js and Browser. Image tracking with 100% pure JavaScript, zero-dependencies, and high-performance compilation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"augmented reality",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"natural-feature-tracking"
|
|
24
24
|
],
|
|
25
25
|
"author": "Sergio Lázaro <slazaro.dev@gmail.com>",
|
|
26
|
-
"license": "
|
|
26
|
+
"license": "Fair Source-0.9",
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
29
|
"url": "git+https://github.com/srsergiolazaro/taptapp-ar.git"
|
package/src/react/types.ts
CHANGED
package/src/react/use-ar.ts
CHANGED
|
@@ -65,6 +65,7 @@ export const useAR = (config: ARConfig): UseARReturn => {
|
|
|
65
65
|
targetSrc: config.targetTaarSrc || config.targetImageSrc,
|
|
66
66
|
overlay: overlayRef.current!,
|
|
67
67
|
scale: config.scale,
|
|
68
|
+
cameraConfig: config.cameraConfig,
|
|
68
69
|
debugMode: false,
|
|
69
70
|
callbacks: {
|
|
70
71
|
onUpdate: (data) => {
|
|
@@ -129,7 +130,7 @@ export const useAR = (config: ARConfig): UseARReturn => {
|
|
|
129
130
|
arInstanceRef.current?.stop();
|
|
130
131
|
arInstanceRef.current = null;
|
|
131
132
|
};
|
|
132
|
-
}, [config.targetTaarSrc, config.targetImageSrc, config.scale]);
|
|
133
|
+
}, [config.targetTaarSrc, config.targetImageSrc, config.scale, config.cameraConfig]);
|
|
133
134
|
|
|
134
135
|
return {
|
|
135
136
|
containerRef,
|