@srsergio/taptapp-ar 1.0.51 β 1.0.53
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 +47 -79
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,44 +83,60 @@ const binaryBuffer = compiler.exportData();
|
|
|
83
83
|
|
|
84
84
|
## π₯ Runtime Usage (AR Tracking)
|
|
85
85
|
|
|
86
|
-
### 1.
|
|
87
|
-
The
|
|
88
|
-
|
|
89
|
-
```html
|
|
90
|
-
<script src="https://aframe.io/releases/1.5.0/aframe.min.js"></script>
|
|
91
|
-
<script src="path/to/@srsergio/taptapp-ar/dist/index.js"></script>
|
|
92
|
-
|
|
93
|
-
<a-scene taar-image="imageTargetSrc: ./targets.taar;">
|
|
94
|
-
<a-camera position="0 0 0" look-controls="enabled: false"></a-camera>
|
|
95
|
-
<a-entity taar-image-target="targetIndex: 0">
|
|
96
|
-
<a-plane position="0 0 0" height="0.552" width="1"></a-plane>
|
|
97
|
-
</a-entity>
|
|
98
|
-
</a-scene>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 2. High-Performance Three.js Wrapper
|
|
102
|
-
For custom Three.js applications:
|
|
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.
|
|
103
88
|
|
|
104
89
|
```javascript
|
|
105
|
-
import {
|
|
90
|
+
import { SimpleAR } from '@srsergio/taptapp-ar';
|
|
106
91
|
|
|
107
|
-
const
|
|
108
|
-
container: document.
|
|
109
|
-
|
|
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 π`)
|
|
110
98
|
});
|
|
111
99
|
|
|
112
|
-
|
|
100
|
+
await ar.start();
|
|
101
|
+
|
|
102
|
+
// When done:
|
|
103
|
+
ar.stop();
|
|
104
|
+
```
|
|
113
105
|
|
|
114
|
-
|
|
115
|
-
|
|
106
|
+
#### π Minimal HTML Example
|
|
107
|
+
```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>
|
|
116
112
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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>
|
|
121
124
|
```
|
|
122
125
|
|
|
123
|
-
|
|
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 each frame with `{ targetIndex, worldMatrix }` |
|
|
135
|
+
| `cameraConfig` | β | Camera constraints (default: `{ facingMode: 'environment', width: 1280, height: 720 }`) |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### 2. Raw Controller (Advanced & Custom Engines)
|
|
124
140
|
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.
|
|
125
141
|
|
|
126
142
|
#### βοΈ Controller Configuration
|
|
@@ -185,56 +201,8 @@ if (targetIndex !== -1) {
|
|
|
185
201
|
}
|
|
186
202
|
```
|
|
187
203
|
|
|
188
|
-
###
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
```javascript
|
|
192
|
-
import { SimpleAR } from '@srsergio/taptapp-ar';
|
|
193
|
-
|
|
194
|
-
const ar = new SimpleAR({
|
|
195
|
-
container: document.getElementById('ar-container'),
|
|
196
|
-
targetSrc: './my-target.taar', // Single URL or array: ['./a.taar', './b.taar']
|
|
197
|
-
overlay: document.getElementById('my-overlay'),
|
|
198
|
-
onFound: ({ targetIndex }) => console.log(`Target ${targetIndex} detected! π―`),
|
|
199
|
-
onLost: ({ targetIndex }) => console.log(`Target ${targetIndex} lost π`)
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
await ar.start();
|
|
203
|
-
|
|
204
|
-
// When done:
|
|
205
|
-
ar.stop();
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
#### π Minimal HTML
|
|
209
|
-
```html
|
|
210
|
-
<div id="ar-container" style="width: 100vw; height: 100vh;">
|
|
211
|
-
<img id="my-overlay" src="./overlay.png"
|
|
212
|
-
style="opacity: 0; z-index: 1; width: 200px; transition: opacity 0.3s;" />
|
|
213
|
-
</div>
|
|
214
|
-
|
|
215
|
-
<script type="module">
|
|
216
|
-
import { SimpleAR } from '@srsergio/taptapp-ar';
|
|
217
|
-
|
|
218
|
-
const ar = new SimpleAR({
|
|
219
|
-
container: document.getElementById('ar-container'),
|
|
220
|
-
targetSrc: './targets.taar',
|
|
221
|
-
overlay: document.getElementById('my-overlay'),
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
ar.start();
|
|
225
|
-
</script>
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
#### βοΈ SimpleAR Options
|
|
229
|
-
| Option | Required | Description |
|
|
230
|
-
| :--- | :--- | :--- |
|
|
231
|
-
| `container` | β
| DOM element where video + overlay render |
|
|
232
|
-
| `targetSrc` | β
| URL to your `.taar` file |
|
|
233
|
-
| `overlay` | β
| DOM element to position on the target |
|
|
234
|
-
| `onFound` | β | Callback when target is detected |
|
|
235
|
-
| `onLost` | β | Callback when target is lost |
|
|
236
|
-
| `onUpdate` | β | Called each frame with `{ targetIndex, worldMatrix }` |
|
|
237
|
-
| `cameraConfig` | β | Camera constraints (default: `{ facingMode: 'environment', width: 1280, height: 720 }`) |
|
|
204
|
+
### π Legacy Usage
|
|
205
|
+
For **A-Frame** or **Three.js** wrappers, please refer to the [Advanced Usage Documentation](./docs/advanced-usage.md).
|
|
238
206
|
|
|
239
207
|
---
|
|
240
208
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srsergio/taptapp-ar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.53",
|
|
4
4
|
"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.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-ar",
|