Creating circular animation in CSS3 Keyframes to give the illusion of a static image while it runs

I am using CSS3 Keyframes to create an image circle that appears to be running like a wheel without actually moving from its position.

Below is the CSS code I have implemented:

.step_7 { 
background: url(../images/step7.png) no-repeat center top, url(../images/outer_glow.png) no-repeat 0 -7px; 
top: 377px;
left: 417px;
width:102px;
height: 104px;
z-index: 4;
}
@-webkit-keyframes circle-run 
{
    0%{
        -webkit-transform:rotate(0deg);
    }
    100% 
    {
        -webkit-transform:rotate(360deg);
    }
}

.animation {
    -webkit-animation: circle-run 2s infinite;
    -webkit-animation-timing-function:linear;
}

Javascipt :

 $('.btn1_inv').click(function () {
        $('.step_7').addClass('animation');
    });

Here is a sample of my code : http://jsfiddle.net/vLwDc/25/

After implementing the above code, my element seems to move slightly. How can I correct this issue? Thank you in advance.

Answer №1

Are you asking why it appears unsteady? It's due to the difference in width and height, causing it not to be a perfectly circular shape.

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

Learn the simple trick to switch to full screen by just clicking

import { Component, OnInit, ElementRef } from '@angular/core'; declare var JQuery : any; @Component({ selector: 'app-presentation', templateUrl: './presentation.component.html', styleUrls: ['./presentation.c ...

Exhibition of items arranged in a floating manner. I am looking to insert a new class within the layout using jquery

Let's dive into a bit more detail. I have a gallery with 9 elements aligned to the left, creating 3 elements per line as shown below: 1 2 3 <--line 1 4 5 6 <--line 2 7 8 9 <--line 3 What I am attempting to do is wh ...

Is there a peculiar issue with CSS float:right in IE9?

These are the styles I'm using: For the parent container: div.musicContainer { width:820px; height:54px; margin-bottom:20px; } And for the child containers: div.hardcorePlayer { width:400px; float:left; border:n ...

Is there a way to position the button on the right side rather than the center using a negative right Y value?

I'm looking for something that: Has a button on the right side, not just beside the input. The current setup involves using an unattractive width: 138%, which doesn't consistently work across different browsers and devices. The button ends up a ...

Changing the Stacking Order of Full-Width Columns in Bootstrap v3

Is it feasible to rearrange the sequence of full width columns in Bootstrap v3? Take into account... -xs (A and B both assigned col-xs-12) [ A ] [ B ] -sm (A and B both designated col-sm-12) [ B ] [ A ] I am aware of the option to use hide/show meth ...

How can I rearrange divs using CSS? Can I add parent 1 in between the children of parent 2

Check out my current HTML code structure: <div class="container> <div class="parent1"></div> <div class="parent2"> <div class="child1"></div> <div class="child2"></div> </div ...

Position floating divs at the bottom of the page

Check out this example on JSFiddle: I'm trying to make the left column align to the bottom, but I can't seem to figure it out. http://jsfiddle.net/magwalls/rdrznzhe/ <div width="100%" class="clear"> <div class="fl" width="50%">I ...

Nested div within another div, shifting position relative to scrolling (React)

My goal is to create a unique effect where an object falls from the sky as the user scrolls down the page. The concept involves having the object div remain stationary in the center of its parent container, positioned 50 pixels from the top. However, when ...

Maintain aspect ratio of SVG image with fixed height using a slice technique

I'm having trouble with an SVG that needs to have a fixed height to avoid looking too big when the width exceeds 2000 pixels on widescreens. I want the clipping mask to always be visible and the background image to be sliced rather than stretched. So ...

What could be preventing certain child elements from rendering in the browser when using scss/ compiled css?

I currently work with the Visual Studio Code editor and execute "npm run sass" in the bash terminal. Whenever I modify the scss file, the terminal displays the following message: => changed: C:\Users\kenne\modern_portfolio\scss&bso ...

Exploring CSS Selectors: Finding Distinct Values Within Child Elements

I am currently in the process of developing selenium tests for a web application. The challenge I am facing is that the application utilizes dynamically generated forms, resulting in a plethora of non-unique elements to navigate through (#ids are limited o ...

What could be causing the error message "Failed to load resource: net::ERR_FILE_NOT_FOUND"?

I am currently working on a form utilizing bootstrap. I encountered an error where the styles are not loading when I open my HTML file from the folder. You can see the error image here. However, everything works fine when I use Live Server in Visual Studi ...

Modifying the text hues within the selection

Looking for a way to style the 'Type' in blue and the '*' in red using CSS? Check out the code below: <option value = '' disabled selected><span style="color:blue">Type </span><span style="col ...

The CSS3 properties controlling my following element will remain fixed after reaching a specific threshold

After successfully creating my personal portfolio website, I've hit a roadblock when it comes to styling beyond the portfolio grid. Despite my best efforts, progress has been slow and frustrating. Realizing that someone with more expertise could quic ...

Issues with Bootstrap slider functionality : Unable to initiate slider as it is not being recognized as

I'm having an issue with my Bootstrap slider not functioning properly. Despite ensuring that all CSS and JS files are loading correctly in my HTML, I keep receiving an error in the console stating: slider is not a function. I have even downloaded the ...

Guide to making an adaptive hamburger menu using Bootstrap

I am currently working on a project where I am attempting to create a responsive navbar with a hamburger menu that shifts the menu to the left when the device has a max-width of 480px. However, I seem to be facing some issues and can't quite figure ou ...

Updating the Animation for Datepicker Closure

While using the date picker, I want it to match the width of the input text box. When closing the date picker, I prefer a smooth and single motion. However, after selecting a from and to date, the datepicker no longer closes smoothly. I have attempted sol ...

Ensuring Consistent Visual Harmony Across Linked Elements

As part of my project developing an iPad app with PhoneGap and jQuery Mobile, I am looking to incorporate a preview pane within a carousel. This preview pane should display smaller versions of the other panes scaled inside it. The panes are dynamic and upd ...

Disappearing input field in DateTimePicker Bootstrap when blurred

Currently, I am utilizing the Bootstrap DateTimePicker plugin to enable users to select a specific date and time. The plugin functions well with one minor issue - whenever the user clicks outside or loses focus on the calendar box, both the box itself and ...

Is it possible to stack one Canvas on top of another?

Right now, I am engaged in a process that involves: creating a canvas and attaching it to a division applying a background image through CSS to that canvas. drawing a hex grid on the canvas placing PNGs on the canvas. animating those PNGs to show "movem ...