Skip to content

Instantly share code, notes, and snippets.

@micycle1
Last active November 17, 2018 21:23
Show Gist options
  • Save micycle1/c0266bc06dc79af9427226d435d424cc to your computer and use it in GitHub Desktop.
Save micycle1/c0266bc06dc79af9427226d435d424cc to your computer and use it in GitHub Desktop.
Triangle Wave Function
Function for triangle-wave y coordinate (oscillate between 0 and m).
y = m - abs(t % (2*m) - m)
Where:
y = output
m = max value (peak)
t = time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment