Last active
August 29, 2015 14:23
-
-
Save ahvonenj/bb8cb729cd3697e778bd to your computer and use it in GitHub Desktop.
Sine and cosine wave between two arbitrary values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sineBetween(min, max, t) | |
{ | |
var halfRange = (max - min) / 2; | |
return min + halfRange + Math.sin(t) * halfRange; | |
} | |
function cosineBetween(min, max, t) | |
{ | |
var halfRange = (max - min) / 2; | |
return min + halfRange + Math.cos(t) * halfRange; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment