मैं एक एनीमेशन बनाने की कोशिश कर रहा हूं जो उपयोगकर्ता की ओर 2 फ्रेंच दरवाजे (या 2 हैच दरवाजे) की तरह दिखता है।UIImageViews को एनिमेट करने के लिए कैसे करें हैच दरवाजे खोलने
मैंने निर्मित UIViewAnimationOptionTransitionFlipFromRight संक्रमण का उपयोग करने का प्रयास किया, लेकिन संक्रमण की उत्पत्ति बाएं किनारे की बजाय UIImageView का केंद्र प्रतीत होती है। असल में मेरे पास 2 UIImageViews हैं जिनमें प्रत्येक भरने की स्क्रीन होती है। मैं चाहता हूं कि एनीमेशन यूआईएममेज व्यू की तरह दिखने के लिए स्क्रीन के केंद्र से किनारों पर उठा रहे हों।
[UIView transitionWithView:leftView
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromRight
animations:^ { leftView.alpha = 0; }
completion:^(BOOL finished) {
[leftView removeFromSuperview];
}];
क्या किसी ने पहले ऐसा कुछ किया है? कोई भी सहायता कमाल की होगी!
अद्यतन: निक लॉकवुड को कार्य कोड धन्यवाद
leftView.layer.anchorPoint = CGPointMake(0, 0.5); // hinge around the left edge
leftView.frame = CGRectMake(0, 0, 160, 460); //reset view position
rightView.layer.anchorPoint = CGPointMake(1.0, 0.5); //hinge around the right edge
rightView.frame = CGRectMake(160, 0, 160, 460); //reset view position
[UIView animateWithDuration:0.75 animations:^{
CATransform3D leftTransform = CATransform3DIdentity;
leftTransform.m34 = -1.0f/500; //dark magic to set the 3D perspective
leftTransform = CATransform3DRotate(leftTransform, -M_PI_2, 0, 1, 0);
leftView.layer.transform = leftTransform;
CATransform3D rightTransform = CATransform3DIdentity;
rightTransform.m34 = -1.0f/500; //dark magic to set the 3D perspective
rightTransform = CATransform3DRotate(rightTransform, M_PI_2, 0, 1, 0);
rightView.layer.transform = rightTransform;
}];
नोट: यदि आप छोड़ दिया और सही दरवाजा रोटेशन पर ऋण चिह्न स्वैप कर सकते हैं बनाने के लिए दरवाजे अंदर खुले हैं। 312 परिप्रेक्ष्य सेट करने के लिए * अंधेरे जादू के लिए –