Function
GridScan
({
enableWebcam = false,
showPreview = false,
modelsPath = 'https://cdn.jsdelivr.net/gh/justadudewhohacks/face-api.js@0.22.2/weights',
sensitivity = 0.55,
lineThickness = 1,
linesColor = '#2F293A',
scanColor = '#FF9FFC',
scanOpacity = 0.4,
gridScale = 0.1,
lineStyle = 'solid',
lineJitter = 0.1,
scanDirection = 'pingpong',
enablePost = true,
bloomIntensity = 0,
bloomThreshold = 0,
bloomSmoothing = 0,
chromaticAberration = 0.002,
noiseIntensity = 0.01,
scanGlow = 0.5,
scanSoftness = 2,
scanPhaseTaper = 0.9,
scanDuration = 2.0,
scanDelay = 2.0,
enableGyro = false,
scanOnClick = false,
snapBackDelay = 250,
className,
style
})
Source from the content-addressed store, hash-verified
| 270 | `; |
| 271 | |
| 272 | export const GridScan = ({ |
| 273 | enableWebcam = false, |
| 274 | showPreview = false, |
| 275 | modelsPath = 'https://cdn.jsdelivr.net/gh/justadudewhohacks/face-api.js@0.22.2/weights', |
| 276 | sensitivity = 0.55, |
| 277 | lineThickness = 1, |
| 278 | linesColor = '#2F293A', |
| 279 | scanColor = '#FF9FFC', |
| 280 | scanOpacity = 0.4, |
| 281 | gridScale = 0.1, |
| 282 | lineStyle = 'solid', |
| 283 | lineJitter = 0.1, |
| 284 | scanDirection = 'pingpong', |
| 285 | enablePost = true, |
| 286 | bloomIntensity = 0, |
| 287 | bloomThreshold = 0, |
| 288 | bloomSmoothing = 0, |
| 289 | chromaticAberration = 0.002, |
| 290 | noiseIntensity = 0.01, |
| 291 | scanGlow = 0.5, |
| 292 | scanSoftness = 2, |
| 293 | scanPhaseTaper = 0.9, |
| 294 | scanDuration = 2.0, |
| 295 | scanDelay = 2.0, |
| 296 | enableGyro = false, |
| 297 | scanOnClick = false, |
| 298 | snapBackDelay = 250, |
| 299 | className, |
| 300 | style |
| 301 | }) => { |
| 302 | const containerRef = useRef(null); |
| 303 | const videoRef = useRef(null); |
| 304 | |
| 305 | const rendererRef = useRef(null); |
| 306 | const materialRef = useRef(null); |
| 307 | const composerRef = useRef(null); |
| 308 | const bloomRef = useRef(null); |
| 309 | const chromaRef = useRef(null); |
| 310 | const rafRef = useRef(null); |
| 311 | |
| 312 | const [modelsReady, setModelsReady] = useState(false); |
| 313 | const [uiFaceActive, setUiFaceActive] = useState(false); |
| 314 | |
| 315 | const lookTarget = useRef(new THREE.Vector2(0, 0)); |
| 316 | const tiltTarget = useRef(0); |
| 317 | const yawTarget = useRef(0); |
| 318 | |
| 319 | const lookCurrent = useRef(new THREE.Vector2(0, 0)); |
| 320 | const lookVel = useRef(new THREE.Vector2(0, 0)); |
| 321 | const tiltCurrent = useRef(0); |
| 322 | const tiltVel = useRef(0); |
| 323 | const yawCurrent = useRef(0); |
| 324 | const yawVel = useRef(0); |
| 325 | |
| 326 | const MAX_SCANS = 8; |
| 327 | const scanStartsRef = useRef([]); |
| 328 | |
| 329 | const pushScan = t => { |
Callers
nothing calls this directly
Tested by
no test coverage detected