Creating a Delicious Earth Progress Pie

I'm looking to incorporate a unique progress bar design on my website, similar to this one:

The progress pie

Can anyone guide me on how to create a progress pie with an image inside it that changes color as it moves?

Answer №1

To create a unique effect, you can utilize two images - one greyscale and the other colored - along with the CSS property clip-path and a script.

  1. Start by layering the greyscale image underneath the colored image.
  2. Apply the clip-path property to reveal only a specific section of the colored image.
  3. Adjust the clip-path values dynamically using either a JavaScript loop or a CSS keyframes animation.

Below is a simplified example using keyframes:

.greyscale {
  filter: grayscale(1);
}

.color {
  overflow: hidden;
  animation: clippy 2s infinite;
}

@keyframes clippy {
  0%    { clip-path: polygon(50% 50%, 50% 0,  50% 0,  50%    0,  50%    0,  50%    0,  50%    0); }
  12.5% { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100%    0, 100%    0, 100%    0, 100%    0); }
  25%   { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 100%, 100%  50%, 100%  50%, 100%  50%); }
  37.5% { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 100%, 100% 100%, 100% 100%, 100% 100%); }  
  50%   { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 100%,  50% 100%,  50% 100%,  50% 100%); }
  62.5% { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 100%,    0 100%,   0  100%,    0 100%); }  
  75%   { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 100%,    0 100%,   0   50%,    0  50%); }  
  87.5% { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 100%,    0 100%,   0     0,    0    0); }
  100%  { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 100%,    0 100%,   0     0,  50%    0); }
}

div {
  border-radius: 50%;
  height: 200px;
  overflow: hidden;
  position: relative;
  width: 200px;  
}

img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  position: absolute;
}
<div>
  <img class="greyscale" src="https://interactive-examples.mdn.mozilla.net/media/examples/balloon-small.jpg">
  <img class="color" src="https://interactive-examples.mdn.mozilla.net/media/examples/balloon-small.jpg">
</div>

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

Steps for Disabling col-sm and col-xs in Bootstrap 3

Hey there! I'm currently working on a template using Bootstrap 3. Initially, I planned to make it responsive for all devices, but I have since changed my mind and decided that the template is already complete. I've utilized col-md in each row, h ...

Maintain the div's aspect ratio by adjusting its width according to its height

I am seeking a way to maintain the width of the .center div in relation to its height, following a 4:3 aspect ratio (4 units wide for every 3 units high). The height of the div should be set to 100%, and I also need to align the div horizontally at the cen ...

How to Center a DIV both Vertically and Horizontally with CSS Positioning?

I'm currently working on a webpage layout where I want to have a main div centered horizontally with three smaller divs inside, aligned both vertically and horizontally with equal spacing. I tried using margin: auto on an empty div to center it in the ...

What is the process of configuring a custom domain for localhost:3000 in a React application?

"scripts": { "start": "cross-env NODE_PATH=src react-scripts start", "build": "cross-env NODE_PATH=src react-scripts build", } Is there a way to replace localhost:3000 with a custom domain in Rea ...

Implementing a PHP form for seamless image uploads

I have been attempting to upload a form that includes an image. I have successfully retrieved the data for the brand name and other fields. However, I am encountering an issue with retrieving the image name and type. Can someone please assist me in ident ...

Dealing with errors when Ajax response is not defined

Trying to display errors when Ajax is unsuccessful, but struggling to access the specific error details. example Here is the information from the network tab playground {"message":"The given data was invalid.","errors":{"title":["The title field is requ ...

Unfortunately, Node Sass does not have compatibility with your current environment, which is Windows 64-bit with an unsupported runtime

Having been a regular user of Node.js to utilize gulp and sass for my HTML projects, I recently encountered a new issue. An error message stating "Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (57)" has no ...

Ensuring Proper Sequence of Function Execution in Angular Directive

I'm a bit confused after reading the following two blogs: Blog I: Eric W Green - Toptal Order of execution Compile -> Controller -> PreLink -> PostLink Blog II: Jason More Order of execution Controller -> Compile -> PreLink ...

Need assistance as require function is not functioning as anticipated

const THREE = require('three'); require('three/examples/js/loaders/OBJLoader.js'); Once I imported threejs from node_modules, I decided to utilize the provided OBJLoader, but encountered an unexpected error. THREE is not defined a ...

The CSS float puzzle - text alignment dilemma

Recently, I created a simple float-based banner with tiles which you can see here on jsfiddle. However, I encountered a major issue with centering text in each tile. My goal is to have all the "Sample text" content centered both horizontally and vertically ...

Utilize PHP to sift through HTML content and extract a specific tag

How can I extract a specific form using PHP? $url = '<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </head> <body> <div class="waitmsg" id="WaitMessage ...

Decrease the font size of text using intervals in CSS

I'm facing a challenge where I need to decrease the font size by 10% every 2 seconds. <div class="shrink"> text </div> .shrink{ transition: 2s linear all; font-size : 20px; } Is there a way to achieve this using only CSS? ...

"Error: Unable to locate module" encountered during the transition to Webpack 5

I am in the process of upgrading my React application to webpack version 5.72.0 (previously on 4.42.1). As part of this update, I have also upgraded webpack-cli to version 4.9.2, webpack-dev-server to version 4.8.1, and babel to version 7.17.9. However, I ...

What is the most efficient method for storing text in my web application?

Hey there, I'm looking for a way to easily store and access the wording used in my application so that I can use them again whenever needed. For example, loading messages, validation messages, or informational messages are some of the wordings I want ...

Text color wave effect - mimic a block of colors flowing through text

I'm experimenting with creating a unique text effect where, upon hovering over the text, it appears as though a block of color is passing through it. Inspired by the technique showcased in this first example (specifically for the word "Kukuri"), I ut ...

Capture an image of the element

Hi there, I'm currently attempting to use PhantomJS to capture a screenshot of a specific element. I'm utilizing the PhantomJS bridge for Node.js: phantom Here's what I have so far: page.includeJs('http://ajax.googleapis.com/ajax/libs ...

Conceal the icon for the Dropdown Menu arrow

Is there a way to hide the old arrow icon in the Select (drop down) after changing it with a new one? HTML: <div class="row"> <div class="col-sm-12"> <select name="country" class="form-control SearchBar"> <option ...

Troubleshooting jQuery and Mootools compatibility problem in Internet Explorer 8

I am currently working on a webpage that is using both Mootools 1.4 and jQuery 1.5.1 at the same time. I understand that this setup is not ideal, but for various reasons, I have no choice in the matter. Most browsers display the page without any issues, ho ...

Sticky sidebar navigation paired with a scrollable main content area and anchor links

Examining the fiddle reveals a straightforward page layout with a fixed menu on the left and scrollable content. I am looking to align the menu with the content without any blank space at the top that causes the menu to shift upwards while scrolling down. ...

Contrasting the purpose of a function in pure JavaScript versus a function within the scope of an Angular controller

Could someone clarify the distinction between declaring these two functions in an angular controller? function demo() { }; scope.demo = function() { }; Are these two functions similar in perf ...