Questions tagged [rotation]

A rotation is a circular movement of an object around a center (or point) of rotation. On a mobile device, it indicates the change of orientation.

A three-dimensional object rotates always around an imaginary line called a rotation axis. If the axis is within the body, and passes through its center of mass the body is said to rotate upon itself, or spin. A rotation about an external point, e.g. the Earth about the Sun, is called a revolution or orbital revolution, typically when it is produced by gravity.

Mathematically, a rotation is a rigid body movement which, unlike a translation, keeps a point fixed. This definition applies to rotations within both two and three dimensions (in a plane and in space, respectively.)

A rotation is commonly represented using , a rotation or .

On a mobile device, it indicates the change of orientation.

12013 questions
1458
votes
34 answers

Activity restart on rotation Android

In my Android application, when I rotate the device (slide out the keyboard) then my Activity is restarted (onCreate is called). Now, this is probably how it's supposed to be, but I do a lot of initial setting up in the onCreate method, so I need…
Isaac Waller
  • 32,709
  • 29
  • 96
  • 107
554
votes
16 answers

Rotating videos with FFmpeg

I have been trying to figure out how to rotate videos with FFmpeg. I am working with iPhone videos taken in portrait mode. I know how to determine the current degrees of rotation using MediaInfo (excellent library, btw) but I'm stuck on FFmpeg…
jocull
  • 20,008
  • 22
  • 105
  • 149
464
votes
23 answers

Why does an image captured using camera intent gets rotated on some devices on Android?

I'm capturing an image and setting it to image view. public void captureImage() { Intent intentCamera = new Intent("android.media.action.IMAGE_CAPTURE"); File filePhoto = new File(Environment.getExternalStorageDirectory(), "Pic.jpg"); …
Shirish Herwade
  • 11,461
  • 20
  • 72
  • 111
353
votes
16 answers

Prevent screen rotation on Android

I have one of my activities which I would like to prevent from rotating because I'm starting an AsyncTask, and screen rotation makes it restart. Is there a way to tell this activity "DO NOT ROTATE the screen even if the user is shaking his phone…
Sephy
  • 50,022
  • 30
  • 123
  • 131
348
votes
7 answers

CSS3 Rotate Animation

Cannot get this animated image to work, it is supposed to do a 360 degrees rotation. I guess something's wrong with the CSS below, as it just stays still. .image { float: left; …
Nikk
  • 7,384
  • 8
  • 44
  • 90
288
votes
29 answers

Evenly space multiple views within a container view

Auto Layout is making my life difficult. In theory, it was going to be really useful when I switched, but I seem to fight it all of the time. I've made a demo project to try to find help. Does anyone know how to make the spaces between views…
nothappybob
  • 3,097
  • 4
  • 16
  • 15
201
votes
2 answers

css rotate a pseudo :after or :before content:""

anyway to make a rotation work on the pseudo content:"\24B6"? I'm trying to rotate a unicode symbol.
devric
  • 3,555
  • 4
  • 22
  • 36
189
votes
27 answers

Android: Rotate image in imageview by an angle

I am using the following code to rotate a image in ImageView by an angle. Is there any simpler and less complex method available. ImageView iv = (ImageView)findViewById(imageviewid); TextView tv = (TextView)findViewById(txtViewsid); Matrix mat = new…
rijinrv
  • 2,029
  • 2
  • 16
  • 17
181
votes
14 answers

JS Client-Side Exif Orientation: Rotate and Mirror JPEG Images

Digital camera photos are often saved as JPEG with an EXIF "orientation" tag. To display correctly, images need to be rotated/mirrored depending on which orientation is set, but browsers ignore this information rendering the image. Even in large…
flexponsive
  • 6,060
  • 8
  • 26
  • 41
175
votes
21 answers

Position fixed doesn't work when using -webkit-transform

I am using -webkit-transform (and -moz-transform / -o-transform) to rotate a div. Also have position fixed added so the div scrolls down with the user. In Firefox it works fine, but in webkit based browsers it's broken. After using the…
iSenne
  • 2,656
  • 5
  • 26
  • 26
154
votes
20 answers

Android: Bitmaps loaded from gallery are rotated in ImageView

When I load an image from the media gallery into a Bitmap, everything is working fine, except that pictures that were shot with the camera while holding the phone vertically, are rotated so that I always get a horizontal picture even though it…
Manuel
  • 8,135
  • 10
  • 32
  • 29
126
votes
16 answers

Best practices for circular shift (rotate) operations in C++

Left and right shift operators (<< and >>) are already available in C++. However, I couldn't find out how I could perform circular shift or rotate operations. How can operations like "Rotate Left" and "Rotate Right" be performed? Rotating right…
Elroy
  • 605
  • 4
  • 12
  • 20
120
votes
43 answers

Rotate the elements in an array in JavaScript

I was wondering what was the most efficient way to rotate a JavaScript array. I came up with this solution, where a positive n rotates the array to the right, and a negative n to the left (-length < n < length) : Array.prototype.rotateRight =…
Jean Vincent
  • 11,995
  • 7
  • 32
  • 24
113
votes
3 answers

Further understanding setRetainInstance(true)

What exactly happens when you call setRetainInstance(true) on a Fragment? The documentation is virtually non-existent and this seems like a very important function. Specifically I want to know how much of this sequence (that I made up) is…
Timmmm
  • 88,195
  • 71
  • 364
  • 509
112
votes
4 answers

Python list rotation

I'd like to rotate a Python list by an arbitrary number of items to the right or left (the latter using a negative argument). Something like this: >>> l = [1,2,3,4] >>> l.rotate(0) [1,2,3,4] >>> l.rotate(1) [4,1,2,3] >>> l.rotate(-1) [2,3,4,1] >>>…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
1
2 3
99 100