SVG Sandbox is a React-based application that allows users to create, manipulate, and animate SVG entities in a dynamic environment. It provides a flexible platform for experimenting with various SVG shapes, behaviors, and animations.
- Create and manipulate SVG entities
- Add custom behaviors and animations to entities
- Real-time rendering and updates
- Entity inspector for detailed view and editing
- AI-powered actions using OpenAI or Groq
- Responsive design with Tailwind CSS
- Node.js (v18 or later recommended)
- pnpm
-
Clone the repository:
git clone https://github.com/your-username/svg-sandbox.git cd svg-sandbox
-
Install dependencies:
pnpm install
-
Start the development server:
pnpm dev
-
Open your browser and navigate to
http://localhost:5173
- Use the PromptBar at the bottom of the screen to input commands
- Select entities by clicking on them
- Inspect and modify entity properties using the EntityInspector
- Use the WorldStateInspector (toggle with ` key) to view the current world state
SVG Sandbox supports AI-powered actions using either OpenAI or Groq. To use these features:
- Obtain an API key from OpenAI or Groq
- When prompted, enter your API key (it will be stored in local storage)
- Use the
go
function in the console to send prompts to the AI service
Example:
go("Create a red circle and make it bounce", "groq")
src/
: Source codecomponents/
: React componentsbehaviors/
: Entity behavior definitionsactions/
: Action definitions and AI integrationstores/
: State management using Valtioutils/
: Utility functionstypes/
: TypeScript type definitions