Created
April 6, 2017 17:02
-
-
Save bigstark/da686779d465fddbc4a0f371faa9da7a to your computer and use it in GitHub Desktop.
This file contains 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
// "positive" is increasing positively horizontally | |
private float[] getHorizontalCenter(int width, int height, boolean positive) { | |
float x = (width - 2 * radius) * (positive ? frame : 1 - frame) + radius; | |
float y = positive ? radius : height - radius; | |
return new float[] {x, y}; | |
} | |
// "negative" is increasing negatively vertically | |
private float[] getVerticalCenter(int width, int height, boolean negative) { | |
float x = negative ? width - radius : radius; | |
float y = (height - 2 * radius) * (negative ? frame : 1 - frame) + radius; | |
return new float[] {x, y}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment