Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6904789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:06:16+00:00 2026-05-27T08:06:16+00:00

I am trying to rotate image that is placed partly on the screen using

  • 0

I am trying to rotate image that is placed partly on the screen using this code:

    final float ROTATE_FROM = 0.0f;
    final float ROTATE_TO = 360.0f;
    RotateAnimation r = new RotateAnimation(ROTATE_FROM, ROTATE_TO,
            Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 0f);
    r.setDuration(300000);     
    r.setRepeatCount(Animation.INFINITE);
    r.setInterpolator(this, android.R.anim.linear_interpolator);

    imv = (ImageView) findViewById(R.id.imageView1);

    imv.startAnimation(r);

But what i get is the image rotating and the parts are where outside the screen are left blank.

What is want the result to be is:

a demopic http://www.11sheep.com/temp/p1.png

Can someone please give me a code snippet?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:06:17+00:00Added an answer on May 27, 2026 at 8:06 am

    here is the code

                Animation anim =new FlipAnim(0, 90, card.getWidth()/2, card.getHeight()/2);
                anim.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
                // TODO Auto-generated method stub
            }
            public void onAnimationRepeat(Animation animation) {
                // TODO Auto-generated method stub
            }
            public void onAnimationEnd(Animation animation) {
    
    
                //              
    
                Animation anim2 =new FlipAnim(-90, 0, card.getWidth()/2, card.getHeight()/2);
                card.startAnimation(anim2);
            }
        });
        card.startAnimation(anim);
    

    here is the code for
    FlipAnim

          import android.graphics.Camera;
          import android.graphics.Matrix;
          import android.view.animation.Animation;
          import android.view.animation.Transformation;
    
      public class FlipAnim  extends Animation {
    private final float mFromDegrees;
    private final float mToDegrees;
    private final float mCenterX;
    private final float mCenterY;
    private Camera mCamera;
    
    public FlipAnim(float fromDegrees, float toDegrees,
            float centerX, float centerY) {
        mFromDegrees = fromDegrees;
        mToDegrees = toDegrees;
        mCenterX = centerX;
        mCenterY = centerY;
        setDuration(400);
    }
    
    @Override
    public void initialize(int width, int height, int parentWidth, int parentHeight) {
        super.initialize(width, height, parentWidth, parentHeight);
        mCamera = new Camera();
    }
    
    @Override
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        final float fromDegrees = mFromDegrees;
        float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);
    
        final float centerX = mCenterX;
        final float centerY = mCenterY;
        final Camera camera = mCamera;
    
        final Matrix matrix = t.getMatrix();
    
        camera.save();
    
        camera.rotateY(degrees);
    
    
        camera.getMatrix(matrix);
        camera.restore();
        matrix.preTranslate(-centerX, -centerY);
        matrix.postTranslate(centerX, centerY);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to rotate an image in OpenCV. I've used this code that
I'm trying to rotate a camera image. The code looks like that: Bitmap result
I'm trying to rotate a rectangle by rotating its points , using this code
I am trying to rotate an image using jquery that will rotate on multiple
I'm trying to get some code that will perform a perspective transformation (in this
I am trying to animate an image using following code: [UIView beginAnimations:nil context:NULL]; [UIView
I am trying to rotate an image. This I am succeeding in doing. The
I trying to spin an image using CSS keyframes to rotate(360deg) . I used
I'm trying to center a rotated image into a destination buffer using GDI+. The
Basically what I'm trying to do is have a picture rotate using mouse events.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.