Code Monkey home page Code Monkey logo

swiftpulse's Introduction

SwiftPulse

This is an iOS component for creating a single pulsing animation. It's a clone from PulsingHalo - so basically all the credits go to @shu223.

I just needed the single pulse animation (left one of the image) and decided to port it to Swift with some minor changes of the interfaces.

PulsingHalo

How to use

  1. Add LFTPulseAnimation to your project.
  2. Init LFTPulseAnimation (e.g. with its custom constructor) and add it to the view
pulseEffect = LFTPulseAnimation(repeatCount: Float.infinity, radius:20, position:imageView.center)
view.layer.insertSublayer(self.pulseEffect, below: imageView.layer)

Customization

radius

Use the radius property to set the max size of the pulse effect.

pulseEffect.radius = 60

color

This is is basically a subclass of CALayer so you can access the backgroundColor attribute of CALayer and set it like you are used to it.

animation duration

Use self.animationDuration to set the duration of one animation cycle. Use the self.pulseInterval property to add an interval to the duration.

animation repeat count

Initialize using LFTPulseAnimation(repeatCount: Float.infinity, radius:20, position:iv.center) to set the repeat count or use the repeatCount property

more properties

For more adjustment just look in the code, it's very easy to understand and should be seld documenting.

Issues & PRs

If someone is interested in porting the multiple pulse effect before I will do it just let me know or do a Pull Request ;)

Special Thanks

Special thanks to @shu223 for PulsingHalo!

swiftpulse's People

Contributors

ahmetws avatar bryant1410 avatar ctews avatar drinkius avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.