iOS Caemitterlayer particle engine

Source: Internet
Author: User

1, Caemittercell particle emitter related properties:

/*coreanimation-caemitterlayer.h Copyright (c) 2007-2017, Apple Inc. All rights reserved. *///The new subclass introduced in iOS5, the particle engine! Particle effects can be achieved! #import<QuartzCore/CALayer.h>@classCaemittercell; Ns_assume_nonnull_beginca_class_available (10.6,5.0,9.0,2.0)@interfaceCaemitterlayer:calayer//Particle emitter@property (nullable, copy) Nsarray<caemittercell *> *emittercells;//Caemittercell (particle)@propertyfloatbirthrate;//birth rate, the number of objects generated per second, the default of 1 seconds a@propertyfloatLifetime//Object Life Time default 1 seconds@property cgpoint emitterposition;//position of the emitter in the XY plane@property CGFloat emitterzposition;//position of the emitter in the Z plane@property cgsize emittersize;//emission source Size@property CGFloat emitterdepth;//depth of transmitter@property (copy) NSString*emittershape;//Emitter Source Shape@property (copy) NSString*emittermode;//Launch Mode@property (copy) NSString*rendermode;//Emitter Rendering Mode@property BOOL preservesdepth;//whether to turn on the three-dimensional effect, default no@propertyfloatVelocity//the speed at which each particle moves@propertyfloatScale//the initial zoom of each object is small@propertyfloatSpin//self-rotating speed@property unsignedintSeed//initialize the seed generated by the random number@end/** ' Emittershape ' values. **/Ca_extern NSString*ConstKcaemitterlayerpoint//point, the particles are emitted from a point! Ca_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayerline//lines, particles emitted from a lineCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayerrectangle//rectangle in which particles are emitted from a rectangleCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayercuboid//cube, z screen has effectCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayercircle//Circular, particles emitted from a circleCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayersphere//Spherical--foreverguard Blog ParkCa_available_starting (10.6,5.0,9.0,2.0);/** ' Emittermode ' values. **/Ca_extern NSString*ConstKcaemitterlayerpoints//emitted from the transmitterCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayeroutline//emitted from the edge of the transmitterCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayersurface//emitted from the transmitter surfaceCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayervolume//sent from the transmitter center .Ca_available_starting (10.6,5.0,9.0,2.0);/** ' Rendermode ' values. **/Ca_extern NSString*ConstKcaemitterlayerunordered//particles appear unorderedCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayeroldestfirst//first-declared particle rendering at the topCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayeroldestlast//post-declared particle rendering at the topCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayerbacktofront//render in the order of the z-axisCa_available_starting (10.6,5.0,9.0,2.0); Ca_extern nsstring*ConstKcaemitterlayeradditive//Particle BlendingCa_available_starting (10.6,5.0,9.0,2.0); Ns_assume_nonnull_end

2. Related properties of Caemittercell particles:

#import<QuartzCore/CALayer.h>ns_assume_nonnull_beginca_class_available (10.6,5.0,9.0,2.0)@interfaceCaemittercell:nsobject <nssecurecoding, camediatiming>{@private    void*_attr[2]; void*_state; uint32_t _flags;}+ (instancetype) Emittercell;//Initialize Method@property (nullable, copy) NSString*name;//the name of the particle@property (Getter=isenabled) BOOL enabled;//the color of the particles@propertyfloatbirthrate;//the speed at which particles are produced@propertyfloatLifetime//Life cycle@propertyfloatLifetimerange;//life cycle increase/decrease range@property cgfloat emissionlatitude;//emission angle of the particle z-axis direction@property CGFloat emissionlongitude;//the emission angle of the particle in the XY plane@property cgfloat emissionrange;//Particle emission angle range@property cgfloat Velocity;//Particle Motion Velocity@property CGFloat Velocityrange;//particle speed Increase/decrease range@property cgfloat xacceleration;//particle x-direction acceleration@property CGFloat yacceleration;//acceleration in the y direction of the particle@property CGFloat zacceleration;//acceleration of particle Z-direction@property cgfloat scale;//Particle Scale Scale@property CGFloat Scalerange;//Particle Scale Scale range@property CGFloat scalespeed;//Particle scale speed@property cgfloat spin;//particle self-rotation@property CGFloat Spinrange;//particle self-rotating range@property (nullable) cgcolorref color;//the color of the particles@propertyfloatRedrange;//Particle color red Change range@propertyfloatGreenrange;//Particle color green Change range@propertyfloatBluerange;//Particle color blue Change range@propertyfloatAlpharange;//Particle Transparency Alpha Change range@propertyfloatRedSpeed;//particle color red changes speed in the life cycle@propertyfloatGreenspeed;//particle color green changes speed in the life cycle@propertyfloatBluespeed;//particle color blue changes speed in the life cycle@propertyfloatAlphaspeed;//Particle Transparency alpha changes speed in the life cycle@property (Nullable, Strong)IDContents//the rendered particle is a picture@property cgrect contentsrect;//Render Range@property cgfloat Contentsscale;//Rendering Area Scaling@property (copy) NSString*minificationfilter;//Zoom Out@property (copy) NSString *magnificationfilter;//Zoom in@propertyfloatMinificationfilterbias;//Shrink Factor//The default value is Kcafilterlinear ' linear '//There are 3 settings in: Kcafilterlinear,kcafilternearest,kcafiltertrilinear//kcafilterlinear: Default value, scaled smooth, but prone to blur effect//kcafiltertrilinear: Basic and Kcafilterlinear are the same//kcafilternearest: Fast speed does not blur, but degrades quality and pixelated images@property (nullable, copy) Nsarray<caemittercell *> *emittercells;//all particles@property (nullable, copy) Nsdictionary*style;@end

iOS Caemitterlayer particle engine

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.