Skip to content

Instantly share code, notes, and snippets.

@tarcieri
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save tarcieri/9658799 to your computer and use it in GitHub Desktop.

Select an option

Save tarcieri/9658799 to your computer and use it in GitHub Desktop.
def phase(differential, max, offset)
absolute = (differential * max + offset) % max
relative = absolute - max / 2
relative < 0 ? -relative : relative
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment