UNPKG

sandai-react

Version:

React components and utilities for the Sandai 3D AI Characters.

80 lines (79 loc) 18.6 kB
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>AI3DCharacter | sandai-react - v0.1.7</title><meta name="description" content="Documentation for sandai-react"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">sandai-react - v0.1.7</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">sandai-react</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.AI3DCharacter.html">AI3DCharacter</a></li></ul><h1>Function AI3DCharacter</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>A React component that renders a 3D character using Sandai.</p> <p>This component dynamically constructs the URL based on the provided props and initializes a <code>SandaiClient</code> instance to interact with the 3D character.</p> </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="ai3dcharacter" class="tsd-anchor"></a><span class="tsd-kind-call-signature">AI3DCharacter</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">props</span><span class="tsd-signature-symbol">:</span> <a href="../types/index.AI3DCharacterProps.html" class="tsd-signature-type tsd-kind-type-alias">AI3DCharacterProps</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Element</span><a href="#ai3dcharacter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">props</span>: <a href="../types/index.AI3DCharacterProps.html" class="tsd-signature-type tsd-kind-type-alias">AI3DCharacterProps</a></span><div class="tsd-comment tsd-typography"><p>The properties passed to the component.</p> </div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">apiKey</span><a id="__typeapikey" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><a href="../types/index.AuthClientMessage.html" class="tsd-signature-type tsd-kind-type-alias">AuthClientMessage</a><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">&quot;apiKey&quot;</span><span class="tsd-signature-symbol">]</span></h5><div class="tsd-comment tsd-typography"><p>Your API key. You can find it in the dashboard</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">armsAnimationSmoothing</span><a id="__typearmsanimationsmoothing" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>Dampens the arms movements.</p> <p>This is a number between 0 and 1, where 0 is the default, so the motions are applied as is, and 1 effectively disables all bone movement.</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">bodyAnimationSmoothing</span><a id="__typebodyanimationsmoothing" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>Dampens the body movements.</p> <p>This is a number between 0 and 1, where 0 is the default, so the motions are applied as is, and 1 effectively disables all bone movement.</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">cameraType</span><a id="__typecameratype" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">&quot;default&quot;</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">&quot;orthographic&quot;</span></h5><div class="tsd-comment tsd-typography"><p>The type of camera the scene should be rendered with &quot;default&quot; is the standard perspective camera &quot;orthographic&quot; is an orhtographic camera</p> <p>Since the two camera types work differently, things like focus have different methods of calculation.</p> <p>For example, having a z-axis in an orthographic camera to control it's position and therefore the relative size of what's in view, the zoom is calculated from that value instead.</p> <p>It still works with the out of box experience, but if you set focus with custom values and switch the camera type, your carefully crafted values will likely look a bit off.</p> <p>If this annoys you, you can open an issue and send a pull- request in the r3f-vrm package in gitlab</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">className</span><a id="__typeclassname" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">debugMode</span><a id="__typedebugmode" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>Skips auth and load checks.</p> <p>Load checks are used to determine if the user has interacted with the iframe yet (among other things), so this should be turned off in prod.</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">environment</span><a id="__typeenvironment" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><a href="../types/index.Environments.html" class="tsd-signature-type tsd-kind-type-alias">Environments</a></h5></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">faceAnimationSmoothing</span><a id="__typefaceanimationsmoothing" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>Dampens the face movements.</p> <p>This is a number between 0 and 1, where 0 is the default, so the motions are applied as is, and 1 effectively disables all bone movement.</p> <p>Also handles face expression smoothing.</p> <p>0 is the default and only applies the default transitory smoothing, meaning for example when the mouth is maxed out at &quot;aa&quot; for 2 seconds and then goes to &quot;ih&quot;, the transition is already smoothed out.</p> <p>1 basically holds the vowel indefinitely.</p> <p>If the mouth movements feel too choppy, try setting this value to somewhere between 0.1 and 0.9</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">handsAnimationSmoothing</span><a id="__typehandsanimationsmoothing" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>Dampens the hand movements.</p> <p>This is a number between 0 and 1, where 0 is the default, so the motions are applied as is, and 1 effectively disables all bone movement.</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">headAnimationSmoothing</span><a id="__typeheadanimationsmoothing" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>Dampens the head movements.</p> <p>This is a number between 0 and 1, where 0 is the default, so the motions are applied as is, and 1 effectively disables all bone movement.</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">initialFocus</span><a id="__typeinitialfocus" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><a href="../types/index.FocusProps.html" class="tsd-signature-type tsd-kind-type-alias">FocusProps</a></h5><div class="tsd-comment tsd-typography"><p>The initial camera properties</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">legsAnimationSmoothing</span><a id="__typelegsanimationsmoothing" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>Dampens the legs movements.</p> <p>This is a number between 0 and 1, where 0 is the default, so the motions are applied as is, and 1 effectively disables all bone movement.</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">lowPerformanceMode</span><a id="__typelowperformancemode" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>Catch-all kind of a switch that will make things run on less powerful hardware. There are a few subtle effects like bloom and depth of field that are enabled by default, but they can be resource-intensive. On modern hardware, they run fine, but if you need to support, say, older android phones, then turning this on is a good idea.</p> <p>Some effects may also cause issues on outdated hardware or software, so turning this on by default may also be a good idea in general, but your milage may vary.</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">onLoad</span><a id="__typeonload" class="tsd-anchor"></a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">client</span><span class="tsd-signature-symbol">:</span> <a href="../classes/index.SandaiClient.html" class="tsd-signature-type tsd-kind-class">SandaiClient</a><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</span></h5></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">raytrace</span><a id="__typeraytrace" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>Whether to use raytracing or not.</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">showControls</span><a id="__typeshowcontrols" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>Shows the Debug-Interface for the built-in engine, giving you access to the predefined motions, emotions and the built-in voices as a neat overlay.</p> <p>Since this technology works with vrm models, and since those models only have 5 emotions by default, it can be useful for looking at how the emotions combine to show the 27 emotions that sandai supports</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">style</span><a id="__typestyle" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">React.CSSProperties</span></h5></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">url</span><a id="__typeurl" class="tsd-anchor"></a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">userId</span><a id="__typeuserid" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><a href="../types/index.AuthClientMessage.html" class="tsd-signature-type tsd-kind-type-alias">AuthClientMessage</a><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">&quot;userId&quot;</span><span class="tsd-signature-symbol">]</span></h5><div class="tsd-comment tsd-typography"><p>Your user ID. You can find it in the dashboard</p> </div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">voiceName</span><a id="__typevoicename" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><a href="../types/index.VoiceNames.html" class="tsd-signature-type tsd-kind-type-alias">VoiceNames</a></h5></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">vrmUrl</span><a id="__typevrmurl" class="tsd-anchor"></a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Element</span></h4><ul> <li>Returns an iframe element that displays the 3D character.</li> </ul> <div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://gitlab.com/DavidCks1/sandai-react/-/blob/3440cc79728639724e2d996dd3dd72f730ad8635/src/index.tsx#L234">sandai-react/src/index.tsx:234</a></li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">sandai-react - v0.1.7</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>