आप ओपनजीएल ES का उपयोग किये बिना UIView
, UIImageView
या CALayer
एनिमेटेड 360 डिग्री्रेस को कैसे घुमाते हैं?आप UIView, UIImageView या CALayer एनिमेटेड 360˚ को कैसे घुमाते हैं?
5
A
उत्तर
3
संभवतः आप एक पूर्ण 360 डिग्री के आसपास UIImage
घूर्णन करने का अनुमान लगाते हैं? मेरे अनुभव में, जिस तरह से एक चक्र पूरा रोटेशन पूरा करने के लिए श्रृंखला के लिए है कई एनिमेशन एक साथ:
- (IBAction)rotate:(id)sender
{
[UIView beginAnimations:@"step1" context:NULL]; {
[UIView setAnimationDuration:1.0];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationDelegate:self];
[imageView.transform = CGAffineTransformMakeRotation(120 * M_PI/180);
} [UIView commitAnimations];
}
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
if ([animationID isEqualToString:@"step1"]) {
[UIView beginAnimations:@"step2" context:NULL]; {
[UIView setAnimationDuration:1.0];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationDelegate:self];
imageView.transform = CGAffineTransformMakeRotation(240 * M_PI/180);
} [UIView commitAnimations];
}
else if ([animationID isEqualToString:@"step2"]) {
[UIView beginAnimations:@"step3" context:NULL]; {
[UIView setAnimationDuration:1.0];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationDelegate:self];
imageView.transform = CGAffineTransformMakeRotation(0);
} [UIView commitAnimations];
}
}
मैं जगह में easeIn/easeOut
वक्र (रेखीय के बजाय) छोड़ दिया है, इसलिए आप व्यक्तिगत एनिमेशन देख सकते हैं।
28
#import <QuartzCore/QuartzCore.h>
CABasicAnimation *fullRotation;
fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotation.fromValue = @(0.0);
fullRotation.toValue = @((360.0 * M_PI)/180.0);
fullRotation.duration = 3.5f;
fullRotation.repeatCount = MAXFLOAT;
[view.layer addAnimation:fullRotation forKey:@"rotation-animation"];
आप लंगर बिंदु यह चारों ओर घूमता को बदलना चाहते हैं तो आप क्या कर सकते हैं
CGRect frame = view.layer.frame;
self.anchorPoint = CGPointMake(0.5, 0.5); // rotates around center
self.frame = frame;
संबंधित मुद्दे
- 1. गोल कोनों UIView या UIImageView
- 2. कई परिवर्तनों को एक UIView/CALayer
- 3. आप आईफोन होम स्क्रीन पर छवियों को कैसे घुमाते हैं?
- 4. UIView और CALayer के बीच अंतर क्या हैं?
- 5. CALAYER
- 6. एनिमेशन, CALayer
- 7. CALayer
- 8. आप UIView के लिए अर्ध-पारदर्शी पृष्ठभूमि कैसे बनाते हैं?
- 9. UIImageView बनाम UIView w/छवि - दक्षता
- 10. 360 डिग्री
- 11. CATransform3DRotate के साथ UIImageView को घुमाने के लिए दरवाजा खोलने जैसे प्रभाव कैसे बनाते हैं?
- 12. CATiledLayer से CALayer
- 13. एंटीएलियासिंग CALayer के बदलने का उपयोग कर परिवर्तन के बाद UIView के किनारों
- 14. आप UIImageView इंस्टेंस की एक प्रति कैसे बनाते हैं?
- 15. बनाम CALayer
- 16. UiImageView
- 17. एक घुमावदार UIView पर एंटीअलाइजिंग कैसे करें (UIImageView नहीं)
- 18. CALayer
- 19. UIView एनीमेशन को कैसे रोकें
- 20. आईफोन UIImage या UIImageView
- 21. हिटटेस्ट गलत UIView
- 22. UIImage या UIImageView को एनिमेट करना?
- 23. UIImageview पर्यवेक्षण
- 24. UIView
- 25. UIView
- 26. मैं UIImageView में प्रोग्रामिंग रूप से UIImage कैसे जोड़ूं, फिर उस UIImageView को किसी अन्य UIView में जोड़ें?
- 27. ड्राइंग CALayer
- 28. आप पीआईएल में एनिमेटेड जीआईएफ छवि को कैसे स्केल करते हैं और एनीमेशन
- 29. CALayer renderInContext
- 30. 360 डिग्री
आपको पता है कि 360˚ रोटेशन आप सटीक एक ही छवि है, है ना दे देंगे? – SteamTrout
मुझे यह दुख हुआ कि मैंने इसे महसूस करने से पहले समाधान के बारे में सोचने की कोशिश करना शुरू कर दिया। – jtbandes
@ स्टेम ट्राउट: केवल तभी जब आप इसे तात्कालिक होना चाहते हैं। – JeremyP