🧠 Description
This creative 404 Error Page Concept combines advanced CSS features like the @property rule, custom variables, and keyframe animations to produce a smooth swinging 3D text effect and dynamic cloak lighting animation. It provides a futuristic “missing page” design that’s minimal yet visually stunning — no external JavaScript animation library required. The effect gives the illusion of the “404” text swinging in space with light shadows moving behind it, representing the “lost” or “missing” theme of the page.
💻 HTML Code
The HTML provides a clean and simple layout for the 404 page:
The "h1" element displays the large “404” error code.
A div structure (.cloak__wrapper, .cloak__container, .cloak) creates the animated shadow cloak, which gives depth and movement behind the main text.
The .info section contains the error message, description, and a Home button ("a" link) to navigate back to the homepage.
This structure separates main visual content (404 animation) from informational content (message and navigation).
CSS Code
This is the core of the project — the animations, colors, and 3D illusion are entirely driven by modern CSS.
Here’s how it works:
Custom CSS Variables & @property: The code defines --swing-x and --swing-y custom properties using the new @property feature, allowing smooth animation of CSS variables across keyframes.
Text Animation: The “404” text uses: radial-gradient for light reflection across the text.
Animated background shifting to simulate light moving.
A blurred duplicate (h1::after) acting as a shadow layer, slightly offset to create a glowing motion effect.
Cloak Animation: The .cloak element rotates based on the --swing-x value, simulating a moving light cloak around the “404”. The gradient background of the cloak darkens the edges and brightens the center to give a depth illusion.
Keyframes: The @keyframes swing animation continuously updates --swing-x and --swing-y values, making both the text and cloak swing left-to-right and up-down in sync.
Typography & Layout: The page uses flexbox for centering, Google Fonts for modern typography, and clamp() for responsive scaling of text and container sizes.
The result is a smooth swinging 3D animation entirely powered by CSS — no JavaScript motion required.
Javascipt Code
In this project, the JavaScript file (script.js) is included, but the animation itself is purely handled by CSS. If used, the script may simply:
Handle navigation back to home.
Add interactivity (like showing extra messages or logging analytics).
Essentially, JavaScript is optional here — the main functionality relies on CSS-driven animations and @property transitions.
