I have been busy with projects for a long time and have not updated my blog.
Just write what you learned on projection.
Original Image:
[[Self view] layer] setbackgroundcolor: [[uicolor blackcolor] cgcolor]; uiimage * balloon = [uiimage imagenamed: @ "mj_207.jpg"]; calayer * reflectionlayer = [[calayer alloc] init]; [reflectionlayer setbounds: cgrectmake (0.0f, 0.0f, 320.0, 480.0)]; [reflectionlayer setposition: cgpointmake (callback, 220.0f)]; [reflectionlayer setcontents :( ID) [Balloon cgimage]; [reflectionlayer setvalue: [nsnumber numberwithfloat: 480.0] forkeypath: @ "-transform. rotation. X "]; //-transform. rotation. X symmetric direction: * gradientlayer = [[cagradientlayer alloc] init]; [gradientlayer setbounds: [reflectionlayer bounds]; [gradientlayer setposition: cgpointmake ([reflectionlayer bounds]. size. width/2, [reflectionlayer bounds]. size. height/2)]; [gradientlayer setcolors: [nsarray arraywithobjects :( ID) [[[uicolor blackcolor] cgcolor], (ID) [[uicolor clearcolor] cgcolor], (ID) [[uicolor clearcolor] cgcolor], (ID) [[uicolor blackcolor] cgcolor], nil]; // how is the Alpha gradient array gradient [gradientlayer setstartpoint: cgpointmake (0.0, 0.4)]; // start point [gradientlayer setendpoint: cgpointmake (0.0, 0.8)]; // The end point is a bit different from the conventional one [reflectionlayer setmask: gradientlayer]; [[self view] layer] addsublayer: reflectionlayer];
:
Change-transform. Rotation. X to transform. Rotation. X to the reflection along the X axis.
:
Change-transform. Rotation. X to transform. Rotation. Y to the reflection along the Y axis.
[Gradientlayersetendpoint: cgpointmake (0.0, 0.8 )]
[Gradientlayer setendpoint: cgpointmake (1.0, 0.8)]
: