How to make image rotation and 3D transform simultaneously?

I am working on image editing application(resize, rotation, 3d transform). If I am rotate the image and then make 3D transform. Its going to initial image. Otherwise I am change the 3D transform then make rotation, Its also goes to the initial state.

For image 3D Transform I am using below code :

- (void)moveImage:(UIPanGestureRecognizer *)recognizer
{
        if ([recognizer respondsToSelector:@selector(translationInView:)]) {
            CGPoint translation = [(UIPanGestureRecognizer *)recognizer translationInView:recognizer.view.superview];

            CALayer *layer = self.layer;
            CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
            rotationAndPerspectiveTransform.m34 = 1.0 / 500.0;
            rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, - self.xTranslation / 50.0 * M_PI / 180.0f, 0.0f, 1.0f, 0.0f);
            layer.transform = rotationAndPerspectiveTransform;
            rotationAndPerspectiveTransform.m34 = - 1.0 / 500.0;
            rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, - self.yTranslation / 50.0 * M_PI / 180.0f, 1.0f, 0.0f, 0.0f);
            layer.transform = rotationAndPerspectiveTransform;
        }
 }

For image Rotation I am using below code :

- (void)rotateImage:(UIRotationGestureRecognizer *)recognizer
{
    if (state == RSImageViewStateResizing) {
        recognizer.view.transform = CGAffineTransformRotate(recognizer.view.transform, recognizer.rotation);
        recognizer.rotation = 0;
    }
}

How to I fix this issue. Always welcome your suggestions, sample code, Sample project, any App store applications. Thanks in advance. Any one help me.

Answers


Use CAAnimationGroup to combine multiple animation into one

CAAnimationGroup *theGroup = [CAAnimationGroup animation];
theGroup.animations=[NSArray arrayWithObject:resizeAnimation, rotationAnimation, 3d transformAnimation];// add here your CAAnimation reference and CATransform3D reference
[layer addAnimation:theGroup forKey:@"animatePosition"];

Need Your Help

SlidingDrawer broke ViewPager workng

android-layout android-viewpager slidingdrawer

I have a simple layout with some page title, ViewPager and SlidingDrawer.

.NET Bootstrap without setup

.net winforms bootstrapping

I have a .NET WinForms application which needs to be run from CD. What I need to figure out is if user has required .NET version installed or install if necessary than run the application after

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.