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.

11204 questions
90
votes
35 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
  • 10,375
  • 5
  • 30
  • 24
85
votes
7 answers

CSS rotation cross browser with jquery.animate()

I'm working on creating a cross-browser compatible rotation (ie9+) and I have the following code in a jsfiddle $(document).ready(function () { DoRotate(30); AnimateRotate(30); }); function DoRotate(d) { $("#MyDiv1").css({ …
frenchie
  • 46,331
  • 96
  • 283
  • 483
83
votes
5 answers

Rotate mp4 videos without re-encoding

I'm looking for a way to rotate videos shot with my Nexus 4 on my Debian Wheezy sytem. The videos are shot in portrait mode and I would like to rotate them to landscape mode. Preferably the rotation is command-line driven. I have found several…
stedes
  • 1,221
  • 2
  • 12
  • 16
82
votes
4 answers

Rotate an image in image source in html

Is there a way I could add in the source of my image codes that could rotate my image? Something like this: I'm making my images dynamic, so I was wondering if I could append some extra code to…
marchemike
  • 2,999
  • 13
  • 42
  • 90
77
votes
11 answers

Rotation of 3D vector?

I have two vectors as Python lists and an angle. E.g.: v = [3,5,0] axis = [4,4,1] theta = 1.2 #radian What is the best/easiest way to get the resulting vector when rotating the v vector around the axis? The rotation should appear to be counter…
Mads Skjern
  • 4,979
  • 5
  • 31
  • 40
77
votes
11 answers

Calculate Bounding box coordinates from a rotated rectangle

I have the coordinates of the top left point of a rectangle as well as its width, height and rotation from 0 to 180 and -0 to -180. I am trying to get the bounding coordinates of the actual box around the rectangle. What is a simple way of…
coulix
  • 3,178
  • 5
  • 50
  • 77
77
votes
4 answers

CSS3 transform: rotate; in IE9

I have an element that needs to be vertical in a design I have done. I have got the css for this to work in all browsers except IE9. I used the filter for IE7 & IE8: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); This however seems to…
wilsonpage
  • 16,275
  • 19
  • 98
  • 144
77
votes
10 answers

HTML5 Canvas Rotate Image

jQuery('#carregar').click(function() { var canvas = document.getElementById('canvas'); var image = document.getElementById('image'); var element = canvas.getContext("2d"); element.clearRect(0, 0, canvas.width, canvas.height); …
73
votes
7 answers

CSS rotate property in IE

I want to rotate the DIV to a certain degree. In FF it functions but in IE I am facing a problem. For example in the following style I can set rotation=1 to 4 filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); This means that the…
user160820
  • 13,598
  • 21
  • 57
  • 91
72
votes
3 answers

iOS: How to run a function after Device has Rotated (Swift)

I have one UIView which is not using Auto-Layout and some components are displayed based on their percent of X and Y co-ordinates from the main view. Previously I would have run a function to update their positions in…
Richard
  • 1,578
  • 3
  • 15
  • 21
70
votes
5 answers

How can you rotate text for UIButton and UILabel in Swift?

How can you rotate text for UIButton and UILabel? 90 degrees, 180 degrees. Note: Before you mark this as a duplicate, I am intentionally modelling my question as a Swift version of this one: How can you rotate text for UIButton and UILabel in…
Suragch
  • 364,799
  • 232
  • 1,155
  • 1,198
70
votes
13 answers

Rotating a view in Android

I have a button that I want to put on a 45 degree angle. For some reason I can't get this to work. Can someone please provide the code to accomplish this?
Matthew
  • 701
  • 1
  • 6
  • 3
69
votes
7 answers

How can you rotate text for UIButton and UILabel in Objective-C?

How can you rotate text for UIButton and UILabel? 90 degrees, 180 degrees.
jdl
  • 5,857
  • 18
  • 80
  • 126
68
votes
14 answers

How to avoid restarting activity when orientation changes on Android

I am creating an Android app in which I'm drawing a view on a canvas. When the device's orientation changes, the activity restarts. I don't want it to. How can I avoid restarting the activity when the orientation changes?
chirag
  • 681
  • 1
  • 5
  • 3
65
votes
6 answers

Why doesn't setVisibility work after a view is animated?

Why doesn't the textView become invisible? Here is my layout xml:
ZippyFerguson
  • 839
  • 1
  • 6
  • 7