Skip to content

jclwong/SLAnimation

Repository files navigation

SLAnimation

Simple and powerful animation library built in Objective-C, compatible with Swift.

Features:

  • Numerous animatable properties
  • Multi-stage animations
  • Callbacks
  • Simplified Effects Wrapper

Installation

SLAnimation is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SLAnimation'

Class: SLAnimUtil

Common effects at your finger tips.

Effects:

  • Shake
  • Pop (in/out)
  • Rise (in/out)
  • Fall (in/out)
  • Slide Left (in/out)
  • Slide Right (in/out)
  • Bounce Left (in/out)
  • Bounce Right (in/out)
  • Unroll Down (in/out)
  • Fade Down (in/out)
  • Fade Up (in/out)

Usage:

Effect: Simple

[SLAnimUtil animEffect:SLA_EFFECT_SHAKE view:view time:0.5];

Effect: With Delay

[SLAnimUtil animEffect:SLA_EFFECT_SHAKE view:view time:0.5 delay:0.5];

Effect: With Delay + Callback

[SLAnimUtil animEffect:SLA_EFFECT_SHAKE view:view time:0.5 delay:0.5 cbTarget:self cbSelector:@selector(onAnimateComplete)];

Example:

Shake

Gif

Pop (In/Out)

Gif

Rise (In/Out) -> No spring motion

Gif

Fall (In/Out) -> No spring motion

Gif

Slide Left (In/Out)

Gif

Bounce Left (In/Out) -> i.e. Slide with a slight spring motion

Gif

Unroll Down (In/Out)

Gif

**Fade Down (In/Out) -> Small vertical displacement, with fade **

**Fade Up (In/Out) -> Small vertical displacement, with fade **

Class: SLAnim

Core class for advanced usage

Compulsary

  • View
  • Time

Animatable Properties:

  • Alpha
  • Center
  • Color: Background
  • Frame
  • Shadow Opacity
  • Transform X, Transform Y, Transform XY

Optional

  • Delay
  • Callback (+ Callback Object)

Usage:

SLAnim *anim = [[SLAnim alloc] init];
// (Set Compulsary)
// (Set Animation Properties)
// (Set Optionals)
[anim animate];

Use-case: Pop In Effect

  • Scale up (slightly larger)
  • Scale down (correct size)
SLAnim *anim = [[SLAnim alloc] initWithView:view];
[anim setTimes:@[@(0.4), @(0.1)]];
[anim setProp:SLA_PROP_TRANSFORM_XY values:@[@0, @1.1, @1]];
[anim animate];

Use-case[2]: Pulse Alpha

  • Fade In
  • Fade Out Slow
  • Optional: Trigger callbacks
SLAnim *anim = [[SLAnim alloc] initWithView:view];
[anim setTimes:@[@(0.1), @(0.4)]];
[anim setProp:SLA_PROP_ALPHA values:@[@0, @1, @0]];
[anim setCallbackTarget:self callbackSelector:@selector(onAnimateComplete)];
[anim animate];

Author

Jack Wong

License

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

About

Simple and Dynamic iOS Animation Library (Obj-C)

Resources

License

Stars

Watchers

Forks

Packages

No packages published