Why must we always begin rotating with 0 in CSS Animation's webkit transform rotate?

Can anyone assist me with this issue? I have created a jsfiddle with an example.

In summary, I am trying to rotate an "orange dart" in a circle every time the user clicks on a link. The rotation works fine, but the problem is that the "orange dart" always starts at 0 degrees instead of continuing from its last position.

Note: This issue is not present in Firefox. Here is a snippet of the code:

HTML

<div id="dart"></div>

<span class="btn js_update1">1</span>
<span class="btn js_update2">2</span>
<span class="btn js_update3">3</span>
<span class="btn js_update4">4</span>
<span class="btn js_update5">5</span>
<span class="btn js_update6">6</span>

JS

to_degree = 0;
var arc_params = {
 center: [218,218],  
 radius: 177,    
 start: 360,
 end: 0,
 dir: -1
}

$('.js_update1').on('click', function() {

from_degree = to_degree;
to_degree = 0;
startChange('freccia_orange',from_degree,to_degree);
arc_params.end = 360;
    if (arc_params.start > 360  )
    {
        arc_params.dir = -1;
    }
    else {
        arc_params.dir = 1;
    }
$("#dart").animate({path : new $.path.arc(arc_params)},980);//end: 0

 arc_params.start = 360;

});
$('.js_update2').on('click', function() {
from_degree = to_degree;
to_degree = 60;
startChange('freccia_orange',from_degree,to_degree);
arc_params.end = 300;
    if (arc_params.start > 300  )
    {
        arc_params.dir = -1;
    }
    else {
        arc_params.dir = 1;
    }
$("#dart").animate({path : new $.path.arc(arc_params)},980);//end: 0

 arc_params.start = 300;
});
/* Remaining click functions for degrees 120, 180, 240, and 300 */

Link to the full code example

Answer №1

When it comes to degrees, 360deg is equivalent to 0deg. Therefore, if you instruct to begin at 360, the starting point will actually be 0 which is accurate. The final degree in a circle is marked as 359.

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

Is your custom login form in Web2py not submitting properly?

My attempt to customize the login form for web2py has hit a roadblock. Despite adding the necessary fields and submit button, nothing seems to be happening. Here's what the code in the form's view looks like: {{include 'web2py_ajax.html&apo ...

methods for performing multiplication on dynamically inserted variables using jquery

I'm trying to dynamically calculate the total amount based on the price and product quantity after changing the value in the #quantity text-box. I implemented the following solution, but upon checking the Firefox console, I noticed that there is no ca ...

Ways to efficiently transfer multiple files from a server to a client using Express in NodeJS

I am working on a NodeJS server to transfer various files, such as images, css files, and js files, to clients. Currently, I have the following code snippet for sending individual files: app.get('/js/client.js', function (req, res) { res.sendF ...

Having difficulties with hovering over a td that has a rowspan

I am encountering some challenges when attempting to hover over a td with rowspan in my HTML table. Despite searching for a solution, I have not been successful. I came across suggestions on forums that hinted at using JS/jQuery. Could someone please provi ...

Ways to include multiple pieces of data in a JQuery Mobile List view

Obtaining JSON data (list of available Hotels within a certain distance) and extracting the following information in JSON format: Name of Hotels, Distance of Hotel from our current location, number of rooms. There might be multiple Hotels within the specif ...

Mastering the art of customizing classes and styles in material-ui (React)

I am facing a challenge with version 1.2.1 of material-ui. My goal is to make the AppBar component transparent by overriding its styles as per the documentation here. This is the code snippet I have been working on: import React, { Component } from ' ...

Manipulate and scale with jQuery

I am currently utilizing the jQueryUI library with its Draggable and Resizable functionalities to resize and drag a div element. However, I am encountering some unexpected behavior where the div jumps outside of its container upon resizing. How can I resol ...

The communication feature using jQuery and PHP is not saving information to the database

I'm currently in the process of setting up a chat page using jQuery and PHP. However, I've encountered an issue where although the Added echo statement appears after submitting data on my simple form, the information is not actually being added t ...

Exploring Angular unit testing using Jasmine: Techniques to customize or delete spyOn

Current software versions for AngularJS and Jasmine: AngularJS v1.2.26 Jasmine v2.2.0 I am facing an issue with a spyOn. When attempting to change or remove its behavior, I encounter the following error message: Error: getUpdate has already been spied u ...

Is this code in line with commonly accepted norms and standards in Javascript and HTML?

Check out this Javascript Quiz script I created: /* Jane Doe. 2022. */ var Questions = [ { Question: "What is 5+2?", Values: ["7", "9", "10", "6"], Answer: 1 }, { Question: "What is the square root of 16?", Values: ["7", "5", "4", "1"], Answer: ...

Vue.js global event issue

Recently, I encountered an issue with the following code: <component-one></component-one> <component-two></component-two> <component-three></component-three> Specifically, component-two contains component-three. My cu ...

Toggle Divs with jQuery (Rotate images depending on link)

I am currently using the following code to toggle the visibility of div elements. http://jsfiddle.net/XwN2L/3120/ In addition, I would like to have a unique image sprite for each link when it is selected. I attempted to assign individual IDs to each link ...

Issues with retrieving $_POST values from a select form in PHP

When the button is clicked, I am sending a AJAX request to my PHP page using POST method with the selected data from a SELECT element. However, I am facing an issue where my PHP IF statements are not evaluating as true. It always defaults to the ELSE condi ...

Why do I keep getting an ExpressionChangedAfterItHasBeenChecked error after trying to update a random color in an

Is there a way to assign a random color from an array without causing the error message: "ExpressionChangedAfterItHasBeenChecked"? Even though the color of the chip changes quickly before the message appears, it seems like it's working. How can I reso ...

Loading content within the designated element

<div class="col-sm-6" id="ajaxform"></div> <!-- begin snippet: js hide: false --> <!-- language: lang-html --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <ul id="accordio ...

Implementing three identical dropdown menus using jQuery and HTML on a single webpage

It seems like I've tangled myself up in a web of confusion. I'm trying to have three identical dropdowns on a single page, each displaying clocks from different cities (so users can view multiple clocks simultaneously). However, whenever I update ...

Using jQuery to Toggle Visibility of Table Rows

I'm facing a challenge in creating a basic table layout where all the table rows are initially hidden when the document loads. The goal is to display specific rows when a corresponding button is clicked, but my current implementation doesn't seem ...

What is the process for converting several files into a base64 string?

I have a component set up like this: <input type="file" multiple @change="toBase64Handler($event)"> <script> data() { return { files: [], } }, methods: { tobase64Handler(event) { // implementation } } </script> I w ...

Retrieve files from Amazon S3 using JavaScript

I'm currently working with a javascript file that's intended to download a text file from one of my S3 buckets. However, after running this file using "node file.js", nothing happens and there's no output. Is there something I'm missing ...

Wrapper Div at the Center

I'm currently working on aligning my webpage in the center using the following CSS: .wrapper { display: flex; align-items: stretch; background: #fafafa; /*max-width: 1520px; */ box-shadow: 1px 1px 12px rgba(0, 0, 0, 0.1); text ...