Skip to content

Instantly share code, notes, and snippets.

@eonist
Created July 26, 2017 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eonist/626530f0b16fadd65fd56971555b736f to your computer and use it in GitHub Desktop.
Save eonist/626530f0b16fadd65fd56971555b736f to your computer and use it in GitHub Desktop.
/**
* NOTE: calculates the entire range of the stage pressures so from stage 0 to 1 the pressure goes from 0 to 0.5 and from stage 1 to 2 the linear pressure goes from 0.5 to 1 this makes it easier to scale things in a linear fashion from 0 to 1 in the entire stage range
*/
var linearPressure:CGFloat{
if event.stage == 0 {
return 0
}else if event.stage == 1{
return pressure / 2
}else /*if stage == 2*/ {
return 0.5 + (pressure / 2)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment