Created
October 28, 2014 01:19
-
-
Save benfoxall/75f162343497d640fecb to your computer and use it in GitHub Desktop.
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
// (cos allows smooth transitions from 0->1->0) | |
// 0 -> 1 stepped sin frequency from 1 -> 5 | |
function stepper(i){ | |
var t = 2*Math.PI* ~~(i * 10); | |
return Math.cos(i*10*t) | |
} | |
// generalised version | |
// stepper = generateStepper(5,1) | |
function generateStepper(steps, initial){ | |
var c = steps * initial * 2 * Math.PI; | |
return function(i){ | |
return Math.cos(~~(i * steps) * i * c) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment