To create an animated RGB glowing effect that transitions smoothly around the border of…
- User
To create an animated RGB glowing effect that transitions smoothly around the border of an element, like the lighting on a Razer Blade RGB keyboard, you can use a gradient along with the @keyframes CSS animation. You need to create a gradient that simulates the RGB light colors and then animate this gradient around the border.
Here is an example of how you could create this effect:
.off-canvas-center .mfp-inline-holder .mfp-content { /* Existing styles… / position: relative; / To position the pseudo-element / animation: rotateColors 10s linear infinite; / Apply the rotate animation / }
.off-canvas-center .mfp-inline-holder .mfp-content::after { content: ‘’; position: absolute; top: -5px; / Adjust the position and size to fit the border / right: -5px; bottom: -5px; left: -5px; border-radius: 24px; / Same as your element’s border-radius / background: linear-gradient( 270deg, rgb(255, 0, 0), rgb(255, 255, 0), rgb(0, 255, 0), rgb(0, 255, 255), rgb(0, 0, 255), rgb(255, 0, 255), rgb(255, 0, 0) ); background-size: 400% 400%; / Large size to spread the gradient / z-index: -1; / Put it behind the content / filter: blur(10px); / Create the glow effect / animation: moveGradient 8s linear infinite; / Apply the gradient animation */ }
@keyframes rotateColors { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(360deg); } }
@keyframes moveGradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
In this CSS:
- A pseudo-element (::after) is created to sit behind the content and to serve as the glowing border.
- The background of the pseudo-element is set as a gradient that covers the color spectrum.
- background-size is set to a large percentage to stretch out the gradient.
- filter: blur(10px); adds a glow effect to the gradient.
- The rotateColors animation is applied to the element to rotate the hue across the spectrum.
- The moveGradient animation moves the gradient horizontally, creating the effect of the colors moving around the border.
- position: relative; is added to the original element to ensure the pseudo-element is positioned relative to it.
- position: absolute; and z-index: -1; are used in the pseudo-element to place the gradient behind the content, and positioning offsets like top, right, bottom, and left are set to expand the gradient beyond the content box, so it appears as a border.
Adjust the filter: blur(); value and the border position offset to achieve the desired glow strength and border widths. Also, tweak the animations’ durations (10s and 8s) to match the speed of the Razer Blade RGB keyboard effect you are mimicking.
Remember to add this CSS to a section of your website that allows custom CSS, such as the WordPress Customizer, as mentioned in previous answers. No the animated color should be on the border not the body
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.