Hologram UI
3/28/2024
Veneta Kochovska
This guide shows how to create a hologram effect like this one in Gameface:
It uses CSS transform , filters , animations and box-shadow to achieve the glowing, transparent look with the moving particles.
The skewed circles are SVGs that have transform applied to them:
The .ellipse
class has rotate3d :
The shadow underneath the ellipses are div elements with box-shadow
:
And they too have the .ellipse
class which applies the transformation.
The light beams are absolutely positioned div elements that have box-shadow which creates the specific glow transparent effect:
To achieve pointy edges we use four vertically aligned elements that have different values for blur and spread-radius :
glow-middle
has higher value for blur-radius giving it a bigger shadow, making the center of the light beam wider. And respectively glow-edge
has a narrower shadow.
The slightly lighter light beams have separate class .highlight
that uses different color for the box shadow:
The image is an SVG with the logo that uses a CSS filter to change the color:
The particle effects are generated using JavaScript and animated using CSS animation. Each particle has box-shadow that adds the glow effect:
The generateParticles(count, diameterBoundaries, coordBoundaries)
accepts 3 arguments:
- the number of particles you want to generate
- an array of lower and upper limit of the diameter
- an array of lower and upper limit of the position coordinates
Example:
Will generate 20 particles with random size ranging from 2 to 8 pixels and will position them with top and left randomly chosen, not exceeding 150.
The size of the particles is dynamic but within a given range. The position is also random, but again - within the boundaries of a container element. Each particle is a square div with border radius equal to its width to make it a circle. The animation is a vertical movement from the starting position to the top of the parent container: