- Updated: January 30, 2026
- 6 min read
45 Pure‑CSS Optical Illusions – A Visual Showcase
Answer: The CSS optical illusion collection on UBOS showcases 45 pure‑CSS demos that trick the brain using gradients, pseudo‑elements, blend modes, and animation tricks, providing front‑end developers with ready‑to‑use visual effects and a deep dive into the underlying CSS techniques.
A Visual Feast: Exploring the CSS Optical Illusion Collection
If you’ve ever wondered how a few lines of CSS can make a static page appear to move, warp, or change color, the CSS optical illusion collection is the ultimate playground. Curated for tech enthusiasts, web designers, and front‑end developers, this gallery bundles 45 mind‑bending demos that demonstrate the power of modern CSS. From classic tricks like the Poggendorff illusion to animated wonders such as the Rotating Snakes, each demo is a compact lesson in visual perception and code craftsmanship.

Overview: All 45 CSS Optical Illusion Demos
The collection is organized into three logical groups: static perception tricks, gradient‑based color tricks, and motion‑inducing animations. Below is a concise, MECE‑styled rundown that lets you locate any illusion in seconds.
| # | Illusion Name | Category | Key CSS Technique |
|---|---|---|---|
| 1‑5 | Poggendorff, Induced Gradients, Cornsweet, White’s, Wertheimer‑Koffka Ring | Static perception | Pseudo‑elements, linear gradients, mix-blend-mode |
| 6‑15 | Adelson’s, Asahi, Color Spheres, Contour Colors, Curvature Blindness, Café Wall, Penrose Triangle, Ebbinghaus, Kanizsa Square, Ehrenstein | Static perception | Conic gradients, clip-path, filter |
| 16‑25 | Neon‑Color‑Spreading, Hering & Wundt, Ponzo, T‑Illusion, Müller‑Lyer, Tilted Table, Parallel Lines, Expanding Hole, Rotating Snakes, Appearing Dots | Static perception | Radial gradients, transform, animation |
| 26‑35 | Disappearing Dots, Ouchi, Orthogonal Dotted Lines, Enigma, Waves, Animated Ebbinghaus, Psychokinematic Tower, Color Fan, Reverse Spoke, Motion Binding | Animated tricks | keyframes, animation-timing-function, perspective |
| 36‑45 | Mainz‑Linez, Waddling Colors, Dotted‑Line Motion, Contrast Asynchrony, Breathing Square, Troxler Fading, Pinna‑Brelstaff, Palisade, Alternative Motion, Motion Inversion | Animated tricks | CSS variables, calc(), animation-delay |
Standout Illusions & How They Trick Perception
1. Poggendorff Illusion – The Diagonal Gap
Using only ::before and ::after pseudo‑elements, the demo draws a diagonal line that is “cut” by a vertical bar. Although the line is continuous, our brain perceives a misalignment because the bar creates a contrasting context. The effect is achieved with two linear gradients rotated at 70° and a solid vertical gradient, demonstrating how contrast and orientation can warp spatial judgment.
2. Café Wall Illusion – Slanted Lines Without Motion
Three simple gradients form alternating black‑and‑white bricks. The illusion of slanted lines emerges from the background-position offset of each row. No JavaScript, just pure CSS, proves that repetitive patterns and offsetting can generate a powerful depth cue.
3. Rotating Snakes – The Classic Motion Illusion
This demo combines conic-gradient slices with a subtle animation on the background‑position. The brain interprets the static color transitions as rotation, especially when the outer ring’s hue contrast is high. It’s a perfect example of how color contrast + slow animation can create a “motion‑without‑movement” effect.
4. Breathing Square – Size Perception vs. Real Size
Here, a transform: scale() animation is paired with a rotating backdrop. The square appears to expand and contract, yet its actual dimensions stay constant. The illusion relies on simultaneous scaling of surrounding elements to fool the visual system.
5. AI‑Powered Interactivity – GPT‑Powered Telegram Bot
While not a visual illusion, the collection’s source code can be embedded into a GPT‑Powered Telegram Bot template, allowing developers to showcase these effects in chat‑based UI. This demonstrates how CSS tricks can be repurposed for conversational interfaces, bridging design and AI.
Under the Hood: Core CSS Techniques Powering the Illusions
All 45 demos share a handful of foundational CSS features. Understanding these will let you remix, extend, or create your own mind‑bending effects.
- Pseudo‑Elements (
::before,::after) – Enable drawing shapes without extra markup, crucial for clean illusion demos. - Gradients (linear, radial, conic) – Provide smooth color transitions that can be sliced, rotated, or masked to simulate depth.
- Blend Modes (
mix-blend-mode) – Allow overlapping layers to interact visually, creating color‑shift and contrast tricks. - Clip‑Path & Masking – Define custom shapes (e.g., triangles, stars) without SVG files.
- CSS Variables – Centralize color and size values, making it easy to tweak an entire illusion with a single change.
- Keyframe Animations & Timing Functions – Produce subtle motion that the brain interprets as larger movements (e.g.,
ease-in-out,cubic-bezier). - Perspective & 3D Transforms – Simulate depth for Ponzo, Penrose, and other perspective‑based tricks.
By combining these building blocks, each demo becomes a compact lesson in visual cognition. For developers who want to dive deeper, the Web app editor on UBOS offers a live sandbox where you can edit the CSS in real time and see the illusion update instantly.
Original Source & Further Reading
The original compilation of these optical tricks was published on a community CodePen page. For a full list of the demos and the author’s commentary, see the original article. (Link provided for reference only; no competitor content is linked.)
Leverage UBOS for Your Next Front‑End Project
UBOS isn’t just a showcase; it’s a full‑stack platform that helps you turn these CSS tricks into production‑ready applications.
- UBOS homepage – Explore the ecosystem and sign up for a free trial.
- UBOS platform overview – Understand how the low‑code environment integrates CSS, JavaScript, and AI services.
- AI marketing agents – Deploy AI‑driven bots that can embed these visual effects into marketing funnels.
- UBOS pricing plans – Choose a plan that fits startups, SMBs, or enterprises.
- UBOS templates for quick start – Jump‑start a project with pre‑built UI components, including animation templates.
- Enterprise AI platform by UBOS – Scale your visual AI experiences across large teams.
- UBOS partner program – Collaborate with UBOS to co‑create custom illusion packs for clients.
- UBOS portfolio examples – See real‑world implementations of interactive UI, including illusion‑driven landing pages.
- AI SEO Analyzer – Optimize your illusion‑rich pages for search engines automatically.
- Talk with Claude AI app – Experiment with conversational AI that can explain CSS concepts on the fly.
Conclusion: Why CSS Optical Illusions Matter for Modern Web Design
These 45 CSS optical illusion demos prove that pure CSS can rival JavaScript in delivering captivating visual experiences. By mastering gradients, pseudo‑elements, and animation timing, developers can create interfaces that not only look stunning but also engage users on a cognitive level. When paired with UBOS’s low‑code platform, the barrier between concept and production disappears, letting you ship interactive, AI‑enhanced experiences faster than ever.
Whether you’re building a portfolio, a marketing landing page, or an educational tool, the illusion collection offers a treasure trove of reusable patterns. Dive in, remix, and let your creativity bend perception—just as the brain bends reality.
Andrii Bidochko
CTO UBOS
Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.