Inspiration
How to Build a Fictional 1920s Art Deco Cipher Machine in the Browser Using Claude 3.5 Sonnet
Ditch the boring Todo apps. Learn how to prompt Claude 3.5 Sonnet to design and code a gorgeous, clicky, fully interactive vintage cryptographic device using raw SVGs and the Web Audio API.
Updated 11/7/2026
Why Build Boring Apps When You Can Build History?
Let’s be honest: the world does not need another React Kanban board. If you are looking to stretch your creative coding muscles and truly test what Anthropic's flagship model is capable of, you need to step away from sterile SaaS dashboards and build something with soul.
We are going back to the roaring twenties. Imagine a heavy, polished mahogany box, brass rotary dials, glowing vacuum tubes, and geometric gold inlay. This guide will show you how to leverage Claude 3.5 Sonnet to generate, style, and program a completely functional, fictional 1920s Art Deco cipher machine right in your browser.
By combining inline SVG rendering with the Web Audio API, we will create a tactile, highly responsive piece of historical fiction that actually encrypts and decrypts messages. Best of all, we will do it without importing a single bulky asset file.
Which AI should I use for this?
Tickd is independent and not affiliated with any AI company.
The Aesthetic Blueprint: Brass, Bakelite, and Bold Lines
To make this machine look authentic, we need to bypass standard CSS frameworks entirely. Tailwind is fantastic for modern layouts, but it won’t give you the metallic sheen of brushed brass or the deep, glassy look of polished bakelite keys. For that, we need raw, nested SVGs with custom linear and radial gradients.
When prompting Claude, you must define the visual vocabulary of the Art Deco movement. We are looking for:
- The Palette: Deep obsidian, rich mahogany browns, tarnished brass golds, and glowing amber indicator lights.
- The Geometry: Stepped borders, sunburst patterns, and sharp, symmetrical framing.
- The Material Textures: Gradients that mimic curved metal cylinders and drop shadows that give physical depth to mechanical keys.
Rather than letting Claude guess what makes these gorgeous antique mechanisms tick, we will feed it explicit design constraints that force it to think like an industrial designer from a bygone era.
Step 1: Prompting the SVG Layout
Your first step is to establish the visual shell. Claude 3.5 Sonnet is incredibly skilled at generating SVG code, but it can lose its way if you ask for the logic and the layout simultaneously. Start with the visual canvas.
Copy this foundational prompt and paste it into Claude, or use it as a base in our prompt generator to refine your own design parameters:
`text
Act as an expert frontend engineer and UI designer specializing in historical-futuristic aesthetics.
I want to build a single-file HTML page containing a fictional 1920s Art Deco cipher machine.
The UI must be rendered entirely inside a highly detailed, responsive SVG. Do not use external images or fonts.
Include the following visual elements in the SVG: 1. A mahogany wood-textured cabinet background with a gold-leaf geometric border. 2. Three rotating brass rotor cylinders at the top, complete with engraved letters (A-Z) and visible increment arrows. 3. A glowing amber vacuum tube that pulses slightly when keys are pressed. 4. A QWERTY-style keyboard made of circular bakelite keys with metallic brass rims. 5. A secret drawer slide-out panel at the bottom showing the "decoded" output on aged parchment paper.
Use CSS variables for the color palette (brass, amber, bakelite, mahogany) and construct rich SVG <linearGradient> and <radialGradient> definitions to give the metallic rims, wood grain, and glowing tubes realistic depth.
`
If the initial render feels a bit off-center, don't panic. You can easily troubleshoot and refine the code blocks. For common issues with SVG clipping or viewports in Claude-generated code, check out our Claude troubleshooting hub for quick structural fixes.
Step 2: Coding the Cryptographic State Machine
Once Claude presents you with a stunning visual interface, it's time to wire up the brains. We aren’t just making an expensive-looking keyboard; we want a working mechanical cipher.
We will implement a simplified three-rotor Enigma-style logic. Each time the user presses a key on the virtual keyboard (or their physical keyboard):
- Rotor 1 steps forward by one position.
- If Rotor 1 completes a full rotation, Rotor 2 steps forward.
- If Rotor 2 completes, Rotor 3 steps.
- The input letter passes through the three virtual rotors (each representing a scrambled alphabet array), hits a virtual "reflector" at the end, and passes back through the rotors in reverse to light up the encrypted letter on the lampboard.
Ask Claude to append this state machine using vanilla JavaScript. Keep it deterministic, clean, and well-documented. You can find detailed breakdowns of these core cryptographic algorithms in our tech glossary.
Step 3: Generating Tactile Audio Feedback
An antique machine must feel heavy. In the browser, physical weight is simulated through sound. Instead of loading heavy MP3 audio assets that might fail to resolve or lag behind user inputs, we can use the Web Audio API to synthesise a satisfying mechanical "clack" on the fly.
Instruct Claude to write a lightweight synthesizer function that triggers on both mousedown and mouseup events. Here is the architectural formula for a mechanical click:
- The Key Down: A rapid, high-frequency pop (using a bandpass-filtered noise buffer or a very fast triangle wave sweep) to simulate metal striking metal.
- The Key Up: A lower, dampened resonance representing the spring-loaded key returning to its resting position.
`javascript
const playMechanicalClick = (isRelease = false) => {
const ctx = new (window.AudioContext || window.webkitAudioContext)();
const osc = ctx.createOscillator();
const gain = ctx.createGain();
osc.type = 'triangle';
// Down-clicks are sharp and high; releases are duller and lower
osc.frequency.setValueAtTime(isRelease ? 120 : 280, ctx.currentTime);
osc.frequency.exponentialRampToValueAtTime(0.01, ctx.currentTime + (isRelease ? 0.08 : 0.05));
gain.gain.setValueAtTime(isRelease ? 0.15 : 0.3, ctx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + (isRelease ? 0.08 : 0.05));
osc.connect(gain);
gain.connect(ctx.destination);
osc.start();
osc.stop(ctx.currentTime + (isRelease ? 0.08 : 0.05));
};
`
Integrating this tiny function makes an unbelievable difference. When you press a key, the brass rotor visibly clicks round, the vacuum tube flares up, and a sharp, metallic pop sounds in your headphones. Suddenly, your browser window feels like a heavy, cold-war-era espionage artifact.
Assembling and Iterating with Claude
When pasting these components together, run the code locally in a simple .html file. If Claude hits its token limit or truncates the SVG code while combining the UI and the logic, simply ask it to split the task:
- First, have it output the complete
<svg>block with static IDs for the keys (e.g.,id="key-a"), rotors (id="rotor-1"), and lamps. - In a separate prompt, ask it to write the
<script>tag that queries those IDs, hooks up the event listeners, manages the cryptographic shifting, and triggers the audio context.
This separation of concerns keeps the model’s generation clean and prevents messy, half-finished code blocks.
The Verdict: The Joy of Fictional Engineering
Building fictional simulators isn't just a brilliant way to spend an afternoon; it’s one of the best ways to understand the deep design capabilities of modern LLMs. By steering Claude 3.5 Sonnet away from standard CSS layouts and pushing it toward raw SVG manipulation and custom audio synthesis, you unlock a level of interactive fidelity that template engines simply cannot match.
Load up your code, set your rotor configurations, and start sending beautifully encrypted, Art Deco messages to your dev team. Who knows? You might just make them appreciate the art of cryptography all over again.
Keep going
Build something with the prompt generator, decode the jargon in the glossary, or compare the tools on our platform deep-dives.