Skip to content

Instantly share code, notes, and snippets.

@sleepynate
Created May 8, 2012 21:21
Show Gist options
  • Save sleepynate/2639407 to your computer and use it in GitHub Desktop.
Save sleepynate/2639407 to your computer and use it in GitHub Desktop.
spinning record view
public class Deck extends View {
// private static final String TAG = "Deck";
private Bitmap mRecordImage;
private RotateAnimation anim;
public Deck(Context context, AttributeSet attrs) {
super(context, attrs);
mRecordImage = BitmapFactory.decodeResource(getResources(),
recordToUse);
mRecordImage = Bitmap.createScaledBitmap(mRecordImage, mRecordImage
.getWidth(), mRecordImage.getHeight(), false);
}
private void createAnim(Canvas canvas) {
anim = new RotateAnimation(0, 360, canvas.getWidth() / 4, canvas
.getHeight() / 3);
anim.setRepeatMode(Animation.RESTART);
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(1333); // 45 rpm!
anim.setInterpolator(new LinearInterpolator());
startAnimation(anim);
}
// ... more code needed, but you get the idea.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment