Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CAGradientLayer *gradient = [CAGradientLayer layer];
- gradient.frame = button.bounds;
- CGFloat x = 71./360; //71度
- float a = pow(sinf((2*M_PI*((x+0.75)/2))),2);
- float b = pow(sinf((2*M_PI*((x+0.0)/2))),2);
- float c = pow(sinf((2*M_PI*((x+0.25)/2))),2);
- float d = pow(sinf((2*M_PI*((x+0.5)/2))),2);
- [gradient setStartPoint:CGPointMake(a, b)];
- [gradient setEndPoint:CGPointMake(c, d)];
- gradient.colors = @[(__bridge id)UIColorFromRGBWithAlpha(0x16E05A,1.0).CGColor,
- (__bridge id)UIColorFromRGBWithAlpha(0x16E09D,1.0).CGColor];
- [button.layer insertSublayer:gradient atIndex:0];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement