Skip to content

dylib/Fire

Repository files navigation

Fire

This application demonstrates the use of Core Animation's particle system classes: CAEmitterLayer and CAEmitterCell. Two emitters and cells are used to create fire and smoke effects. Particle images are loaded from the application's bundle and the properties of the particles and emitters are animated.

FireAppDelegate.h/m

Standard app delegate generated by Xcode for a new project.

AppController.h/m

This is the main controller for the application and handles the setup of the layer objects, connecting them up to the view, responding to slider events, and animating the CAEmitterLayer & CAEmitterCell objects. An instance of this class resides in MainMenu.xib and uses an IBOutlet reference for the view and slider (which has been wired up through Interface Builder).

-awakeFromNib

This method will be called when the AppController instance is 'defrosted' from the nib and will setup the layer hierarchy and set the initial vales for the CAEmitterLayer & CAEmitterCell objects.

-(IBAction)slidersChanged:(id)sender

Called when the slider value is changed by the user. The properties of the CAEmitterLayer & CAEmitterCell objects will be animated based on the new slider value to produce a corresponding fire effect.

-(CGImageRef)CGImageNamed:(NSString*)name

Auxiliary function used to generate a CGImageRef from the specified PNG file located in the application bundle.

About

CAEmitterLayer Example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published