A CocoaPod that simplifies creation of particle effects. Supplied with UIPanGestureRecognizer subclass.
We know how to add some visual allure to your mobile app and can't wait to share with you. Meet new open-source library for iOS applications created by Cleveroad. CRParticleEffect function will make any pan touch visually attractive and memorable by adding unique particle effect. To know all the advantages of CRParticleEffect library and find out how to implement it into your app, read our blog post - How we created Particle Effect for iOS apps
Watch the animation of Particle Effect on Cleveroad YouTube Channel in HD quality:
CRParticleEffect is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "CRParticleEffect"
and run pod install
in terminal.
#import <CRparticleEffect/CRParticleEffect.h>
-
-
CRParticleEffectLayer *layer = [[CRParticleEffectLayer alloc] initWithImages:@[...]];
Note: By default
CRParticleEffectLayer
scales images respecting[UIScreen mainScreen].scale
. Set layer'scontentScale
to change this behavior. -
CRParticleEffectLayer *layer = [[CRParticleEffectLayer alloc] initWithImages:@[...] emitterCellConfigBlock:^(CAEmitterCell * _Nonnull emitterCell, NSInteger index) { emitterCell.birthRate = 10 * (index + 1); }];
-
particleEffectLayer.color = [[UIColor redColor] colorWithAlphaComponent:0.75f]
-
-
- Supports storyboards;
- Set
minimumNumberOfTouches
andmaximumNumberOfTouches
to limit number of active particle effects. - Implement
CRMagicPanGestureRecognizerDelegate
to customize particle effects behavior.
-
- (CRParticleEffectLayer *)gestureRecognizer:(CRMagicPanGestureRecognizer *)gestureRecognizer particleEffectLayerForTouch:(UITouch *)touch withIndex:(NSUInteger)index { //Supply particleEffectLayer for each new touch with index return [[CRParticleEffectLayer alloc] initWithImages:@[self.images[index]]]; } - (void)gestureRecognizer:(CRMagicPanGestureRecognizer *)gestureRecognizer willShowParticleEffectLayer:(CRParticleEffectLayer *)particleEffectLayer forTouch:(UITouch *)touch withIndex:(NSUInteger)index { //Change particles color for every touch with index particleEffectLayer.color = self.colors[index]; } - (void)gestureRecognizer:(CRMagicPanGestureRecognizer *)gestureRecognizer willMoveParticleEffectLayer:(CRParticleEffectLayer *)particleEffectLayer forTouch:(UITouch *)touch withIndex:(NSUInteger)index { //Update particle effect's attributes during panning (dragging) for specific touch with index }
- Use white images with transparent background;
- If you do not supply multiple resolutions set
CRparticleEffectLayer
'scontentScale
to 1.
To run the example project, clone the repo, and run pod install
from the Example directory first.
If you have any questions, please contact us for support at [email protected] (email subject: «CRParticleEffect support.»)
or
Use our contacts:
Cleveroad.com
Facebook account
Twitter account
Youtube account
Google+ account
LinkedIn account
Dribbble account
CRParticleEffect is available under the MIT license. See the LICENSE file for more info.