Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat: add AvatarCreator functionality and styles for creating avatars
nirholas6af1c41405df
diff --git a/src/app.js b/src/app.jsindex 2b0cca9c1..5f4e40253 100644--- a/src/app.js+++ b/src/app.js@@ -5,6 +5,7 @@ import { SimpleDropzone } from 'simple-dropzone';import { Validator } from './validator.js';import { Footer } from './components/footer';import { AvaturnAgent } from './avaturn-agent.js';+import { AvatarCreator } from './avatar-creator.js';import { resolveURI, isDecentralizedURI } from './ipfs.js';import queryString from 'query-string';@@ -41,6 +42,7 @@ class App {this.validator = new Validator(el);this.createDropzone();+ this.setupAvatarCreator();this.hideSpinner();const options = this.options;@@ -73,6 +75,20 @@ class App {dropCtrl.on('droperror', () => this.hideSpinner());}+ /**+ * Sets up the Create Avatar button and AvatarCreator instance.+ */+ setupAvatarCreator() {+ this.avatarCreator = new AvatarCreator(document.body, (glbUrl) => {+ this.view(glbUrl, '', new Map());+ });++ const btn = document.getElementById('create-avatar-btn');+ if (btn) {+ btn.addEventListener('click', () => this.avatarCreator.open());+ }+ }+/*** Sets up the view manager.* @return {Viewer}diff --git a/style.css b/style.cssindex da6e7458f..8b183fe85 100644--- a/style.css+++ b/style.css@@ -1178,3 +1178,172 @@ footer .separator {padding: var(--space-lg) var(--space-md);}}++/******************************************************************************+ * Create Avatar Button+ */++.create-avatar-btn {+ display: inline-flex;+ align-items: center;+ gap: var(--space-xs);+ padding: var(--space-sm) var(--space-lg);+ background: rgba(123, 47, 247, 0.15);+ border: 1px solid rgba(123, 47, 247, 0.3);+ border-radius: var(--radius-lg);+ color: rgba(255, 255, 255, 0.7);+ font-family: inherit;+ font-size: var(--text-sm);+ font-weight: 500;+ cursor: pointer;+ transition: all 0.25s ease;+ letter-spacing: 0.02em;+}++.create-avatar-btn:hover {+ background: rgba(123, 47, 247, 0.3);+ color: #fff;+ border-color: rgba(123, 47, 247, 0.5);+}++.create-avatar-btn:active {+ background: rgba(123, 47, 247, 0.4);+ transform: scale(0.97);+}++.create-avatar-btn svg {+ width: 1em;+ height: 1em;+ fill: currentColor;+}++@media screen and (max-width: 700px) {+ .create-avatar-btn span {+ display: none;+ }++ .create-avatar-btn {+ padding: var(--space-xs) var(--space-sm);+ }+}++/******************************************************************************+ * Avatar Creator Modal+ */++.avatar-creator-overlay {+ position: fixed;+ inset: 0;+ z-index: 100;+ display: flex;+ align-items: center;+ justify-content: center;+ background: rgba(0, 0, 0, 0.9);+ backdrop-filter: blur(24px);+ -webkit-backdrop-filter: blur(24px);+ animation: avatar-creator-fadein 0.25s ease;+}++@keyframes avatar-creator-fadein {+ from { opacity: 0; }+ to { opacity: 1; }+}++.avatar-creator-modal {+ width: 95vw;+ height: 90vh;+ max-width: 1200px;+ display: flex;+ flex-direction: column;+ background: rgba(10, 10, 10, 0.95);+ border: 1px solid rgba(255, 255, 255, 0.08);+ border-radius: var(--radius-lg);+ overflow: hidden;+ box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);+}++.avatar-creator-header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: var(--space-sm) var(--space-lg);+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);+ flex-shrink: 0;+}++.avatar-creator-title {+ font-size: var(--text-lg);+ font-weight: 500;+ color: #fff;+ letter-spacing: 0.03em;+}++.avatar-creator-close {+ background: none;+ border: none;+ color: rgba(255, 255, 255, 0.4);+ font-size: var(--text-2xl);+ cursor: pointer;+ padding: 0;+ line-height: 1;+ transition: color 0.2s ease;+}++.avatar-creator-close:hover {+ color: #fff;+}++.avatar-creator-body {+ flex: 1;+ position: relative;+ min-height: 0;+}++.avatar-creator-container {+ width: 100%;+ height: 100%;+ position: absolute;+ inset: 0;+}++.avatar-creator-iframe {+ width: 100%;+ height: 100%;+ border: none;+}++.avatar-creator-loading {+ position: absolute;+ inset: 0;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: var(--space-md);+ color: rgba(255, 255, 255, 0.4);+ font-size: var(--text-sm);+ pointer-events: none;+}++.avatar-creator-loading .spinner {+ position: static;+ margin: 0;+}++.avatar-creator-error {+ color: #f87171;+ font-size: var(--text-sm);+}++@media screen and (max-width: 700px) {+ .avatar-creator-modal {+ width: 100vw;+ height: 100vh;+ max-width: none;+ border-radius: 0;+ }++ .avatar-creator-header {+ padding: var(--space-xs) var(--space-md);+ }+}