Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8779697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:51:42+00:00 2026-06-13T19:51:42+00:00

Im working on a dial that rotates when a user touches it and drags

  • 0

Im working on a dial that rotates when a user touches it and drags it around. So far so good, but when the dial gets to more than 360, the value goes back to 0, making the animation jump backwards around the dial instead of continuing.

dialRotation = (atan2(event->localY()-circleCenterY, event->localX()-circleCenterX) * (180/M_PI));

Does anyone know how to stop it from jumping?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:51:43+00:00Added an answer on June 13, 2026 at 7:51 pm

    You can use the existing value to determine if you should go beyond 360 or not. Perhaps something like this:

    currentValue = dialRotation;
    dialRotation = (atan2(event->localY()-circleCenterY, event->localX()-circleCenterX) * (180/M_PI));
    dialRotation = 360.0 * floor(fmod(currentValue, 360.0)) + dialRotation;
    

    I think this will work in the negative direction, too, though I sometimes get confused by fmod()s behavior for negative numbers, so be sure to check it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a site right now that I've been working on for more than
Working on my first EmberJS app. The entire app requires that a user be
Problem: I'm working on a website where there is a dial that displays a
Working with an undisclosed API, I found a function that can set the number
Working in Drupal today and simple cell spacing has been anything but simple for
Working in Java FX 2.2. The Scene has a horizontal width that is fixed
I want to work with Asterisk and develop some Programs for working with that.
Working example: http://alpha.jsfiddle.net/gTpWv/ Both of the methods work separately, but once regexp for smilies
Working with a Lucene index, I have a standard document format that looks something
working on xcode I realized that if I create a non-void method, I call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.