title: Force CALayer's rotation direction?
body: <p>This one has been driving me nuts...</p>
  
  <p>Considering "plane" is a CALayer, I rotate it in the X axis:</p>
  
  <pre><code>plane.transform = CATransform3DMakeRotation(180 * M_PI / 180.0f, 1.0f, 0.0f, 0.0f);
  </code></pre>
  
  <p>And this makes it rotate clockwise, which is perfect.</p>
  
  <p>Now, at some point in time, I want it to return to 0 degrees, so I use:</p>
  
  <pre><code>plane.transform = CATransform3DMakeRotation(0 * M_PI / 180.0f, 1.0f, 0.0f, 0.0f);
  </code></pre>
  
  <p>The thing is... it does it anti-clockwise, which is not what I want :(</p>
  
  <p>I'm guessing it uses the shortest rotation path, but even if I tell it to go to 360 degrees instead, when it's done and I tell it to restart the animation, it starts from 360 to go to 180, and it goes backwards instead of the right direction.</p>
  
  <p>Is there a way to workaround that?</p>
  
  <p>What I'd do in <strong>Actionscript</strong> would be:</p>
  
  <pre><code>if (plane.rotationX == 360) plane.rotationX = 0;
  </code></pre>
  
  <p>And it'd resume nicely, but if I do that using <strong>CATransform3DMakeRotation</strong> both transformations collide, because of the animation (I think) and it gets messed up.</p>
  
  <p>Any help would be much appreciated!</p>
  
  <p>Thanks</p>