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
54
votes
5 answers

How to calculate rotation in 2D in Javascript

I am not so familiar trigonometry, but I have only two points to rotate in 2D: *nx, ny . - . - . angle - *cx,cy.................*x,y cx, cy = rotation center x,y = current…
Digerkam
  • 1,826
  • 4
  • 24
  • 39
54
votes
3 answers

Rotate ImageView source from layout xml file

I have this ImageView in my layout:
mehrmoudi
  • 1,096
  • 1
  • 11
  • 22
52
votes
13 answers

how to create iphone's wobbling icon effect?

I want to wobble an image back and forth in my application similar to how the iPhone icons wobble when you press down on it. What's the best way to do that? This is my first foray into animations that's not using an animated GIF. I think the…
jeanniey
  • 523
  • 1
  • 5
  • 5
52
votes
11 answers

Get element -moz-transform:rotate value in jQuery

I have CSS style for a layer: .element { -webkit-transform: rotate(7.5deg); -moz-transform: rotate(7.5deg); -ms-transform: rotate(7.5deg); -o-transform: rotate(7.5deg); transform: rotate(7.5deg); } Is…
Goldie
  • 1,570
  • 5
  • 21
  • 33
52
votes
6 answers

iOS 8 Rotation Methods Deprecation - Backwards Compatibility

In iOS 8, the methods for interface rotation are deprecated. This includes: willRotateToInterfaceOrientation:duration: didRotateFromInterfaceOrientation: willAnimateRotationToInterfaceOrientation:duration: The replacement methods…
fabb
  • 11,660
  • 13
  • 67
  • 111
52
votes
6 answers

Getting the correct bounds of UIViewController's view

I have an iPad-application. In landscape orientation the UIViewController's view actual width = 1024px and height = 768 - 20 (statusBar) - 44 (navigationBar) = 704px. So I wanna get this [1024 x 704] size and I'm using self.view.bounds for it. It…
demon9733
  • 1,054
  • 3
  • 13
  • 35
51
votes
8 answers

CSS3 transform on click using pure CSS

I'm trying to get an image (a plus symbol) to rotate 45 degrees to create a cross symbol. I have so far managed to achieve this using the code below but its working on hover, I wanted to have it rotate on click. Is there a simple way of doing so…
user2498890
  • 1,528
  • 4
  • 25
  • 58
50
votes
16 answers

Tetris Piece Rotation Algorithm

What are the best algorithms (and explanations) for representing and rotating the pieces of a tetris game? I always find the piece rotation and representation schemes confusing. Most tetris games seem to use a naive "remake the array of blocks" at…
user21826
  • 3,524
  • 5
  • 28
  • 28
50
votes
14 answers

How to rotate an image 90 degrees on iOS?

What I want to do is take a snapshot from my camera , send it to a server and then the server sends me back the image on a viewController. If the image is in portrait mode the image appears well on screen , however if the image was taken in…
user1511244
  • 725
  • 3
  • 11
  • 15
48
votes
6 answers

How do I rotate an image around its center using Pygame?

I had been trying to rotate an image around its center in using pygame.transform.rotate() but it's not working. Specifically the part that hangs is rot_image = rot_image.subsurface(rot_rect).copy(). I get the exception: ValueError: subsurface…
Miha
  • 501
  • 1
  • 4
  • 4
48
votes
5 answers

Component of a quaternion rotation around an axis

I'm having trouble finding any good information on this topic. Basically I want to find the component of a quaternion rotation, that is around a given axis (not necessarily X, Y or Z - any arbitrary unit vector). Sort of like projecting a quaternion…
Ben Hymers
  • 25,586
  • 16
  • 59
  • 84
48
votes
9 answers

iOS 6 shouldAutorotate: is NOT being called

I have been scouring the internet for a solution to this but am finding nothing. I am trying to make my iOS 5 app iOS 6 compatible. I cannot get the orientation stuff to work right. I am unable to detect when a rotation is about to happen. Here is…
Lizza
  • 2,769
  • 5
  • 39
  • 72
46
votes
3 answers

Rotate a div using javascript

I want to click on one div and rotate another div then when the firsts div is clicked again the other div rotates back to its original position. I can reference this library if required http://ricostacruz.com/jquery.transit.
user2078845
  • 579
  • 2
  • 7
  • 12
45
votes
5 answers

CGAffineTransform Reset

3I have an image that gets manipulated by touch. Lets say its an image of an arrow that points up. After it's been rotated 180 degrees, so the arrow is pointing down now, I want to reset CGAffineTransform properties so that it thinks now its turned…
Gizmodo
  • 3,151
  • 7
  • 45
  • 92
44
votes
11 answers

Losing data when rotate screen

I have a little funny bug in my application. When the user rotates the screen I lose some of the data in my activity. Anyone that have an idea of why this happens?
Roland
  • 5,328
  • 10
  • 37
  • 55