0

I'm writing the code for my own live wallpaper. The wallpaper (among other things) has a background bitmap that rotates continuously. The bitmap is big (768x768px). Every screen refresh I do:

canvas.drawColor(Color.WHITE);
Matrix matrix = new Matrix();
matrix.setRotate(degrees, background.getWidth() / 2, background.getHeight() / 2);
canvas.drawBitmap(background, matrix, paint);

The wallpaper will run 12-18 FPS. Is this too heavy? Are there better ways to do this? Thank you in advance.

mneri
  • 2,127
  • 2
  • 23
  • 34

1 Answers1

1

You can try Using Animation,

For Sample Example,

RotateAnimation animationRotator = new RotateAnimation(0f, 360f, 10f, 10f);
animationRotator.setInterpolator(new LinearInterpolator());
animationRotator.setRepeatCount(Animation.INFINITE); // For Infinite Rotation
animationRotator.setDuration(1000); // Duration in which one rotation should get over

yourView.startAnimation(animationRotator);
RPB
  • 16,006
  • 16
  • 55
  • 79