What is the method to create an animation that radiates from the center point?

I have developed animations featuring diagonally moving circular patterns.

div {
  width: 100%;
  height: 100vh;
  background-image: radial-gradient(#85c79f 7px, transparent 7px), radial-gradient(#fc536c 7px, transparent 7px), radial-gradient(#e99377 7px, transparent 7px), radial-gradient(#ebe49a 7px, transparent 7px);
  animation: animation1 5s infinite linear;
  background-size: 100px 100px;
}

@keyframes animation1 {
  from {
    background-position: 0 0, 50px 0, 25px 50px, 75px 50px;
  }
  to {
    background-position: -100px -100px, -50px -100px, -75px -50px, -25px -50px;
  }
}
<div></div>

I am interested in transforming this into an animation where each circle expands outwards from the center of the viewport.

However, as the background-image property is not Animatable, I am uncertain about how to execute this effect.

Could you provide guidance on achieving this?

Answer №1

To achieve the desired effect, you can create animation using the properties background-size and/or background-position:

body {
  margin:0;
  height: 100vh;
  background-image: radial-gradient(#85c79f 7px, transparent 7px), radial-gradient(#fc536c 7px, transparent 7px), radial-gradient(#e99377 7px, transparent 7px), radial-gradient(#ebe49a 7px, transparent 7px);
  animation: animation1 5s infinite linear;
  background-size: 20px 20px;
  background-position: 50% calc(50% + 20px), calc(50% - 20px) 50%, calc(50% + 20px) 50%, 50% calc(50% - 20px);
}

@keyframes animation1 {
  from {
    background-size: 20px 20px;
    background-position: calc(50% - 10px) calc(50% + 20px), calc(50% - 20px) calc(50% + 10px), calc(50% + 20px) calc(50% - 10px), calc(50% + 10px) calc(50% - 20px);
  }
  to {
    background-size: 300px 300px;
    background-position: calc(50% - 10px) calc(50% + 100px), calc(50% - 100px) calc(50% + 10px), calc(50% + 100px) calc(50% - 10px), calc(50% + 10px) calc(50% - 100px);
  }
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Dynamically setting CSS values with jQuery to center an image within a div

I'm trying to center an image in a div according to the width of the image after I scale it to have a height of 250px. For example, if I had an image with dimensions 625x450 and, in my CSS file, set the height of the image to be 250px, then the width ...

Creating a shape image border with a clickable container can be achieved by using a combination of HTML and CSS

I'm trying to achieve the border effect shown in the picture while keeping the area under the frame clickable. I've tried using a div on top of another div, which works, but the bottom div is not clickable. I also attempted using a border image, ...

Tips for modifying a particular element within a class?

I am seeking guidance on how to modify a specific class attribute in CSS/JS/JQuery when hovering over a different element. Here is an example: <h1 class="result">Lorium</h1> <h1 class="result">Ipsum</h1> <h1 class="result">Do ...

Poor text display quality on Internet Explorer

Are there any solutions to improve font display on Internet Explorer for Windows? font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; Check out this 100% crop comparison: Left: IE Right: FF ...

Achieving vertical alignment and stretching of subchild within a flexbox element

I am in the process of creating a mobile navigation menu using Flexbox. It will be a vertical menu that occupies 100% of the available height, with the navigation items evenly spaced and taking up the entire height. The structure I am using is ul>li> ...

What is the best way to line up the two stacked elements with a shared background image to give the appearance of a single cohesive image?

The layout of the header on my website's homepage is as follows: <header> <div class="navbar-lock"></div> <div class="hero"></div> </header> In this setup, div.navbar-lock represents a fixed navigation bar wit ...

Having difficulty aligning the button in the center

I encountered an issue trying to center a button, I attempted to use text-align: center, but it didn't have the desired effect. .regis-btn { border-radius: 0px; text-align: center; -moz-border-radius: 10px; -webkit-border-radius: 10px; -o ...

Having trouble getting items to align properly in Bootstrap

As a student, I am struggling with my development skills while attempting to create a personal website. I am encountering difficulty aligning items on my rows in bootstrap. Here is what I am trying to accomplish: 1. However, I am currently stuck at this po ...

Ways to combine text styling with images, stroke effects, and shadows all at once

I am looking to enhance my text with a background image, a text-stroke, and a text-shadow. The issue I am facing is that the text-shadow appears on top of the background image. Does anyone have a solution for placing the shadow behind the image? If you te ...

Ensure that the inner div has a height of 100%

Can someone help me troubleshoot my HTML code? <div id="container"> <div id="left-container"> </div> <div id="right-container"> </div> </div> Although the container is set to 100% height, the #left_con ...

looking to change the background color of a CSS element

Here is a CSS code snippet that I am struggling with: .select, .input, .schedule, .editableFields { cursor: pointer; background-color: blue; } However, the above code overrides this one: #past .layer.color { background-color: #E5D403 !import ...

Disabling the movement of arrows in the client-testimonials-carousel plugin

This plugin that I'm currently using is working flawlessly: However, I'm unsure about how to make the arrows stationary and prevent them from moving. Currently, they are centering themselves based on the height of the div, but I want them to rem ...

employing JavaScript to present an image

Here is the image code I have: <img id="imgId" src="img/cart.png" style="display: none"/> After clicking a button, it triggers a JavaScript function to show the image document.getElementById("imgId").style.display = "inline" The image display ...

What is the best way to place my website's logo in the top-left corner using html and css?

Hello everyone. I am currently working on customizing a website using an HTML and CSS template for a project, but I need to make some modifications. My main goal is to add the company logo to the header, specifically in the top-left corner, however, I&apo ...

The aesthetic of react-bootstrap and material ui aesthetics is distinctive and visually appealing

As I develop my web application, I have incorporated react-bootstrap for its React components based on Bootstrap. However, wanting to give my project a customized look inspired by Material design, I came across bootstrap-material-design. I am curious if I ...

increasing the margin around a heading inside a container with existing padding

I'm currently struggling to apply padding to the header of this container. For some reason, I can't seem to add any padding to the left or right. The image below illustrates the current appearance. Here's the code snippet: <?php $feed = ...

Tips for preventing the overlap of two divs positioned absolutely within a div that is positioned relatively

I have a code snippet that works perfectly when there is enough space to display all the divs without overlapping. However, when I resize the page to its minimum, the two absolute positioned divs start to overlap. Is there a way to prevent this from happen ...

Challenge with Hovering within Cufon Elements

When utilizing multiple lists and hover states, the parent Cufon style takes over the child. For instance, in the scenario below, when hovering over the Second Level link, it will switch to a different weight. Is there a setting I can adjust to keep the n ...

I'm having trouble with Gutters GX and GY not functioning properly in Bootstrap, HTML, and CSS

I attempted to incorporate gutters into my Bootstrap grid layout, however, they are not showing up as expected. I am following the guidelines provided on the Bootstrap documentation, but for some reason, the gutters are not appearing. <!DOCTYPE html> ...

Tips for repositioning the window when linking to a different section of a website

As a beginner in HTML and CSS, I am currently working on adding a navigation bar to my one-page website. I want the navigation bar to smoothly guide users to different sections of the page when they click on a link. To achieve this, I am using anchors and ...