Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

How this use? #9

Closed
webserveis opened this issue Nov 21, 2016 · 1 comment
Closed

How this use? #9

webserveis opened this issue Nov 21, 2016 · 1 comment

Comments

@webserveis
Copy link

How to get the value, angle value?

@milosmns
Copy link
Owner

milosmns commented Nov 21, 2016

Currently, you get the angle value from the [0, 1] float range depending on your start_angle value. This angle value represents the percentage of the circle that the slider went around (standard radian, counter-clockwise). For example, if you set the start_angle to 3.14 (Pi), your 'zero' would be on the left side. If you would like to convert these values to the human clock form ('zero' on top, clockwise), you can use the following two functions to convert to clock value and back. Both return a value from the [0, 1] range so you can multiply with your values - clock values would obviously be in the [1, 12] range.

Converter functions for start_angle="3.14" example:

// you get the angle from the slider listener
float convertAngleToClock(float angle) {
    return (3f / 4f - angle) % 1;
}
// use the returned value in the `setPosition(float)` method
float convertClockToPosition(float clock) {
    return 1f - ((1f / 4f + clock) % 1);
}

It's very similar for other start_value angles, you just change the 1/4 and 3/4 values to your rotation phases.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants