No Login Data Private Local Save

Houdini Paint Perspective Cube - Online CSS Art

6
0
0
0

Houdini Paint Perspective Cube

CSS 3D & Houdini Paint API — Interactive CSS Art Generator

Your browser: —
FRONT
BACK
RIGHT
LEFT
TOP
BOTTOM
Perspective
Near Far
800px
Rotation
-25°
45°
0°
Cube Size
80px 400px
200px
Preset Views
Face Colors
Front
Back
Right
Left
Top
Bottom
Houdini Paint Pattern
Houdini Paint API requires Chromium-based browser (Chrome/Edge 84+)
Auto-Rotate Speed
Slow Fast
4
Generated CSS & HTML
/* Generated CSS will appear here... Adjust controls to update */

Frequently Asked Questions

What is a CSS 3D Perspective Cube?
A CSS 3D perspective cube is a pure CSS/HTML construct that uses transform-style: preserve-3d and the perspective property to create a realistic three-dimensional cube. Each of the six faces is an HTML element positioned in 3D space using translateZ() and rotateX/Y() transforms. The perspective property on the parent container controls the depth effect — smaller values create a more dramatic foreshortening, while larger values produce a flatter, more orthographic look. This technique requires no JavaScript for rendering and performs excellently on modern browsers.
What is CSS Houdini Paint API and how does it enhance the cube?
The CSS Houdini Paint API (part of the CSS Houdini suite) lets developers define custom painting logic via JavaScript paint worklets. Instead of relying solely on background images or gradients, you can programmatically draw patterns, textures, and effects onto any element's background. When applied to a 3D cube's faces, Houdini paint worklets can generate dynamic dot grids, stripes, checkerboards, noise textures, and infinitely more — all rendered at native speed by the browser's compositor. The worklet runs off the main thread, ensuring smooth 60fps rendering even during animations. Combined with CSS custom properties, worklet parameters can be updated in real time without repaints.
Which browsers support CSS Houdini Paint API?
As of 2024, the CSS Houdini Paint API is supported in Chromium-based browsers: Google Chrome (84+), Microsoft Edge (84+), Opera (70+), Samsung Internet (14+), and other Blink-based browsers. Firefox and Safari do not yet ship the Paint API (though Firefox has expressed interest). This tool detects your browser's capabilities and gracefully falls back to solid colors if Houdini is unavailable. For cross-browser projects, always provide a CSS fallback using @supports(background: paint(id)).
How do I use the generated code in my own project?
Step 1: Copy the HTML structure (the .scene-container and .cube-wrapper with all six .cube-face elements).
Step 2: Copy the CSS styles into your stylesheet. Pay attention to the perspective value and transform properties.
Step 3 (Houdini only): Create a .js file with the paint worklet code (use registerPaint()), then load it via CSS.paintWorklet.addModule('your-worklet.js').
Step 4: Apply the worklet to cube faces using background-image: paint(yourPattern) in your CSS. Use CSS custom properties (like --dot-color) to parameterize the pattern dynamically.
What does the perspective CSS property do?
The perspective property defines the distance between the viewer and the z=0 plane in a 3D scene. A smaller value (e.g., 300px) places the viewer closer, creating a more dramatic, wide-angle effect with pronounced foreshortening. A larger value (e.g., 1500px) moves the viewer farther away, producing a subtler, more orthographic projection. This tool lets you experiment with values from 200px to 2000px to see the difference in real time. The perspective is applied to the parent container and affects all child elements with 3D transforms.
Why use transform-style: preserve-3d?
By default, nested 3D-transformed elements are flattened into the parent's plane (transform-style: flat). Setting transform-style: preserve-3d tells the browser to maintain the 3D spatial relationships between child elements. This is essential for constructing a cube: without it, all six faces would collapse into a single flat plane, destroying the 3D illusion. The property must be set on the direct parent of the transformed children (the .cube-wrapper in our case).
Can I animate the cube with CSS keyframes?
Absolutely! You can define a @keyframes animation that rotates the cube continuously. For example: @keyframes spin { from { transform: rotateX(-25deg) rotateY(0deg); } to { transform: rotateX(-25deg) rotateY(360deg); } }. Apply it with animation: spin 8s linear infinite; on the .cube-wrapper. This tool's auto-rotate feature uses requestAnimationFrame for smooth, controllable animation, but CSS keyframes are a great lightweight alternative for simple continuous rotations.
What are the performance considerations for 3D CSS transforms?
3D CSS transforms are GPU-accelerated in all modern browsers, making them very performant. However, keep these tips in mind: (1) Use will-change: transform sparingly — only on elements that will animate frequently; (2) Avoid excessively large cube faces with complex Houdini paint patterns on low-end devices; (3) backface-visibility: hidden can improve performance if you don't need to see the back of faces; (4) Limit the number of simultaneously animating 3D elements; (5) Profile with Chrome DevTools' Performance panel if you notice jank. For most use cases, a single 3D cube with Houdini-decorated faces runs smoothly at 60fps.