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: v49View latest version
A creative web application that inverts the concept of tracing. Users draw simple sketches on a realistic digital canvas that are automatically transformed by AI into rich, detailed artwork appearing as a background layer.
- ποΈ Realistic Canvas Experience: Beautiful canvas/paper-like UI with artistic textures and shadows
- β¨ Auto-Generation: AI generates artwork automatically as you draw - no buttons to press!
- π True Tracing Experience: Your sketch appears as a semi-transparent overlay on the AI-generated background
- π Toggle Views: Switch between showing your sketch overlay or the pure AI artwork
- β‘ Responsive Drawing: Low-latency drawing experience using the Ink API with Pointer Events fallback
- πΎ 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
- Watch: AI automatically generates artwork in the background as you draw (after a 500ms pause)
- Toggle: Use the "Show AI Only" button to switch between overlay and pure AI views
- Save: Download your generated image using the save button
Ctrl/Cmd + N: Clear the canvasCtrl/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