Public
Like
1
tracey-mctraceface
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v17View latest version
A creative web application that inverts the concept of tracing. Users draw simple sketches that are transformed by AI into rich, detailed artwork.
- Responsive Drawing Canvas: Low-latency drawing experience using the Ink API with Pointer Events fallback
- AI Image Generation: Powered by Google's Gemini 2.5 Flash Image Preview model
- Modern File Saving: Uses File System Access API with traditional download fallback
- Accessible Design: Full keyboard navigation and WCAG AA compliance
βββ backend/
β βββ index.ts # Main API endpoint with Gemini integration
βββ frontend/
β βββ index.html # Main HTML template
β βββ app.js # Main application logic
β βββ components/
β β βββ drawing-canvas.js # Drawing canvas Web Component
β β βββ control-panel.js # Control panel Web Component
β βββ style.css # Custom styles
βββ README.md
-
Set the API Key: Add your Google Gemini API key as an environment variable in Val Town:
- Go to your Val Town settings
- Add
GEMINI_API_KEYwith your Google AI Studio API key - Get your API key from: https://aistudio.google.com/app/apikey
-
Access the Application: The application will be available at the HTTP endpoint URL provided by Val Town
- Draw: Use your mouse, finger, or stylus to draw a simple sketch on the canvas
- Generate: Click the "Generate" button to send your sketch to AI
- Wait: The AI will transform your sketch into detailed artwork
- Save: Download your generated image using the save button
Ctrl/Cmd + N: Clear the canvasCtrl/Cmd + Enter: Generate AI artworkCtrl/Cmd + S: Save the generated imageDelete/Backspace: Clear canvas (when canvas is focused)
- Frontend: Vanilla JavaScript with Web Components, Tailwind CSS
- Backend: Deno runtime on Val Town with Hono framework
- AI Model: Google Gemini 2.5 Flash Image Preview
- Canvas: HTML5 Canvas with optimized 2D context for low latency