Latest 0.0.2
Homepage https://github.com/Cleveroad/CRParticleEffect
License MIT
Platforms ios 7.0, requires ARC
Authors

CRParticleEffect Awesome CRParticleEffect CRParticleEffect

A CocoaPod that simplifies creation of particle effects. Supplied with UIPanGestureRecognizer subclass.

CRParticleEffect

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

Installation

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>

Usage

  • CRParticleEffectLayer

    • Init with array of images NSArray<UIImage *>:
      CRParticleEffectLayer *layer = [[CRParticleEffectLayer alloc] initWithImages:@[...]];

      Note: By default CRParticleEffectLayer scales images respecting [UIScreen mainScreen].scale. Set layer’s contentScale to change this behavior.

    • Config CAEmitterCell for every image in array:
      CRParticleEffectLayer *layer =
      [[CRParticleEffectLayer alloc] initWithImages:@[...]
                          emitterCellConfigBlock:^(CAEmitterCell * _Nonnull emitterCell, NSInteger index) {
      emitterCell.birthRate = 10 * (index + 1);
      }];
    • Set color for all particle effect’s cells with layer’s color property
      particleEffectLayer.color = [[UIColor redColor] colorWithAlphaComponent:0.75f]
  • CRMagicPanGestureRecognizer

    • Supports storyboards;
    • Set minimumNumberOfTouches and maximumNumberOfTouches to limit number of active particle effects.
    • Implement CRMagicPanGestureRecognizerDelegate to customize particle effects behavior.
  • CRMagicPanGestureRecognizerDelegate

    - (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
    }

Custom particle images

  • Use white images with transparent background;
  • If you do not supply multiple resolutions set CRparticleEffectLayer‘s contentScale to 1.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Support

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

License

CRParticleEffect is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "CRParticleEffect",
    "version": "0.0.2",
    "summary": "A UIPanGestureRecognizer subclass that provides particle effect on finger movement and simple CAEmitterLayer subclass",
    "description": "A CocoaPod that simplifies creation of the particle effects. Supplied with UIPanGestureRecognizer subclass. Customize particle effect for every touch on screen separately. Works with storyboards.",
    "homepage": "https://github.com/Cleveroad/CRParticleEffect",
    "screenshots": "https://www.cleveroad.com/public/comercial/CRParticleEffect.gif",
    "license": "MIT",
    "authors": {
        "Ihor Teltov": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Cleveroad/CRParticleEffect.git",
        "tag": "0.0.2"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*.{h,m}",
    "resource_bundles": {
        "CRParticleEffect": [
            "Pod/Assets/*.xcassets/**/*.png"
        ]
    }
}

Pin It on Pinterest

Share This