#import "ViewController.h"
@interface Viewcontroller () {
Calayer *_l1;//definition can be used globally
Calayer *_l2;
}
@end
@implementation Viewcontroller
-(void) Viewdidload {
[Super Viewdidload];
Calayer *L2 = [Calayer layer];
L2.frame = CGRectMake (50, 50, 100, 100);
L2.backgroundcolor = [Uicolor Greencolor]. Cgcolor;
L2.transform = Catransform3dmakerotation (M_pi_4, 1, 1, 0);//rotation
[Self.view.layer ADDSUBLAYER:L2];
_L2 = L2;
Calayer *L1 = [Calayer layer];//Create and initialize
L1.frame = CGRectMake (50, 50, 100, 100);
L1.backgroundcolor = [Uicolor Yellowcolor]. cgcolor;//background Color
l1.doublesided = NO; Whether two sides
L1.transform = Catransform3dmakerotation (M_pi_4, 1, 1, 0);//rotation
L1.cornerradius = 30;//When it's a rectangle, this is going to turn into a rounded corner at Four Corners. If there is a picture, the effect is not displayed directly.
L1.maskstobounds = no;//This is when there is a picture will be the extra part of the force cut, you can display the fillet
L1.contents = (__bridge ID) (([UIImage imagenamed:@ "1.jpg"]. Cgimage));//Add a picture
L1.bordercolor = [Uicolor Redcolor]. cgcolor;//Border Color
L1.borderwidth = size of 10;//border
L1.opacity = 1;//Transparency
L1.shadowcolor = [Uicolor blackcolor]. cgcolor;//Shadow Color
L1.shadowopacity = 1;//Shadow Transparency
L1.shadowoffset = Cgsizemake (10, 10);
L1.shadowradius = 6;//radius area size
[Self.view.layer addsublayer:l1];//Show effect on page
_L1 = L1;
}
-(Ibaction) didclicked: (ID) Sender {
_l1.bounds = CGRectMake (0, 0, 100, 100);
_l1.position = cgpointmake (0, 0);//center point to coordinate display
_l1.anchorpoint = Cgpointmake (0, 1);//Anchor Point
_l1.zposition = 100;//above Z axis
_l1.doublesided = no;//Negative None
_l1.transform = Catransform3dmakerotation (m_pi, 1, 0, 0);//rotation
_l2.transform = catransform3didentity;
}
-(Ibaction) DIDCLICKED2: (ID) Sender {
_l2.transform = Catransform3dmakerotation (m_pi, 1, 0, 0);
_l1.transform = catransform3didentity;
}
-(void) didreceivememorywarning {
[Super didreceivememorywarning];
Dispose of any resources the can be recreated.
}
@end
iOS layer animations