Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easier way to make sure a number is in range #22

Open
meodai opened this issue Nov 4, 2021 · 1 comment
Open

Easier way to make sure a number is in range #22

meodai opened this issue Nov 4, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@meodai
Copy link

meodai commented Nov 4, 2021

$value: (360 + $value) % 360;

you add you value to 360 (if the value is negative it will be subtracted) and then modulo 360 (meaning the rest of a division by 360)

@while $value >= 360 {
$value: $value - 360;
}
@while $value < 0 {
$value: $value + 360;
}

made a JS example: https://codepen.io/meodai/pen/dcc6b03dbde04469bc54fead46235c7a

@danielhaim1
Copy link
Member

danielhaim1 commented Nov 5, 2021

Neat, thanks @meodai. I'm working on a separate branch. with a lot of new additions and fixes. I'll go through this thread once it's merged and add your recommendation.

@danielhaim1 danielhaim1 self-assigned this Nov 5, 2021
@danielhaim1 danielhaim1 added the enhancement New feature or request label Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants