facebook twitter hatena line google mixi email

Android/グラフィック/星型

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
float rad = (mFrameIndex / 10) % 3.6;
float x1 = (float)(200 * Math.cos(rad * Math.PI)) + 250;
float y1 = (float)(200 * Math.sin(rad * Math.PI)) + 250;
float x2 = (float)(200 * Math.cos((rad + 0.4) * Math.PI)) + 250;
float y2 = (float)(200 * Math.sin((rad + 0.4) * Math.PI)) + 250;
float x3 = (float)(200 * Math.cos((rad + 0.8) * Math.PI)) + 250;
float y3 = (float)(200 * Math.sin((rad + 0.8) * Math.PI)) + 250;
float x4 = (float)(200 * Math.cos((rad + 1.2) * Math.PI)) + 250;
float y4 = (float)(200 * Math.sin((rad + 1.2) * Math.PI)) + 250;
float x5 = (float)(200 * Math.cos((rad + 1.6) * Math.PI)) + 250;
float y5 = (float)(200 * Math.sin((rad + 1.6) * Math.PI)) + 250;
Paint paint = new Paint();
paint.setColor(Color.argb(255, 25, 25, 25));
canvas.drawLine(x1, y1, x3, y3, paint);
canvas.drawLine(x1, y1, x4, y4, paint);
canvas.drawLine(x2, y2, x4, y4, paint);
canvas.drawLine(x2, y2, x5, y5, paint);
canvas.drawLine(x3, y3, x5, y5, paint);