IOS image reflection projection principles

Source: Internet
Author: User

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)]


:






Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.