Using Caemitterlayer to produce particle effects

Source: Internet
Author: User


#import "ViewController.h"@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; /*Initialize Layer*/        //Create LayerCaemitterlayer *emitterlayer =[Caemitterlayer layer]; //Show BorderEmitterlayer.borderwidth =1. F; //given sizeEmitterlayer.frame = CGRectMake ( -, -, -, -); //Launch PointEmitterlayer.emitterposition = Cgpointmake (0,0); //Launch ModeEmitterlayer.emittermode =Kcaemitterlayersurface; //Launch ShapeEmitterlayer.emittershape =Kcaemitterlayerline; //Add Layer[Self.view.layer Addsublayer:emitterlayer]; /*Initializing particles*/Caemittercell*emittercell =[Caemittercell Emittercell]; //particle yield (that is, how much the particles produce)Emittercell.birthrate =1. F; //particle life cycle (seconds)Emittercell.lifetime = -. F; //Velocity of particlesEmittercell.velocity = -; //set the range of particle speed changes (if not set, then the velocity of the particles is always ten)//the speed value after setting is (between 7~13)Emittercell.velocityrange =3. F; //set Acceleration direction (Y-axis acceleration)Emittercell.yacceleration =2. F; //Particle emission angleEmittercell.emissionrange =4. f *M_1_pi; //set up a picture of the particle displayEmittercell.contents = (__bridgeID_nullable) ([UIImage imagenamed:@" One"].        Cgimage); //set the color of a particleEmittercell.color =[Uicolor Blackcolor].        Cgcolor; /*make Emitterlayer and Emittercell related*/Emitterlayer.emittercells=@[emittercell];}@end


Using Caemitterlayer to produce particle effects

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: 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.