Last active
October 30, 2015 10:54
-
-
Save cloudshooterhuman/1d445e079401fd20aa7a 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
@Override | |
public void draw(Canvas canvas, Paint paint) { | |
float radius = getWidth() / 10; | |
Log.v("Width :",""+getWidth()); | |
Log.v("Height :",""+getHeight()); | |
for (int i = 0; i < 8; i++) { | |
canvas.save(); | |
Point point = circleAt(getWidth(), getHeight(), getWidth() / 2.5f - radius, i * (Math.PI / 4)); | |
Log.v("Point.x : ",""+point.x); | |
Log.v("Point.y : ",""+point.y); | |
canvas.translate(point.x, point.y); | |
canvas.scale(scaleFloats[i], scaleFloats[i]); | |
canvas.rotate(i * 45); | |
Log.v("rotation : ", "" + i * 45); | |
paint.setAlpha(alphas[i]); | |
RectF rectF = new RectF(-radius, -radius / 1.5f, 1.5f * radius, radius / 1.5f); | |
canvas.drawRoundRect(rectF, 1, 1, paint); | |
canvas.restore(); | |
} | |
Point circleAt(int width, int height, float radius, double angle) { | |
float x = (float) (width / 2 + radius * (Math.cos(angle))); | |
float y = (float) (height / 2 + radius * (Math.sin(angle))); | |
return new Point(x, y); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment