Skip to content

Ease Animations for Buttons (Objective C)

Weiping Huang edited this page May 13, 2017 · 3 revisions

Use different and cute ease-animations for buttons.

Swift | Objective-C

Ease Animation

Ease animation, in other words, time interpolator, defines the rate of change of an animation. This allows animations to have non-linear motion, such as acceleration and deceleration. Check cubic-bezier to have some funs about ease animations.

In BMB, for each boom-button, there are 6 kinds of animations when booming or re-booming. You can set different eases for animations by names of supported eases, or customize your own ease.

  1. Move animation when booming.

    bmb.boomMoveEaseName = VHEaseInBack;
    

    The default value is VHEaseOutBack

  2. Rotate animation when booming.

    bmb.boomRotateEaseName = VHEaseInBack;
    

    The default value is VHEaseOutBack

  3. Scale animation when booming.

    bmb.boomScaleEaseName = VHEaseLinear;
    

    The default value is VHEaseOutBack

  4. Move animation when re-booming.

    bmb.reboomMoveEaseName = VHEaseInBack;
    

    The default value is VHEaseInBack

  5. Rotate animation when re-booming.

    bmb.reboomRotateEaseName = VHEaseInBack;
    

    The default value is VHEaseInBack

  6. Scale animation when re-booming.

    bmb.reboomScaleEaseName = VHEaseInBack;
    

    The default value is VHEaseInBack

You can change movement, scale and rotation animations’ ease name with a line of code:

bmb.boomEaseName = VHEaseOutCirc;
bmb.reboomEaseName = VHEaseOutCirc;

Or if you want a customized ease:

@interface CustomTimeInterpolator : NSObject<VHTimeInterpolator>

@end

@implementation CustomTimeInterpolator

- (CGFloat)interpolation:(CGFloat)offset
{
    return offset < 0.5 ? offset : MIN(offset * 1.5, 1);
}

@end
...
bmb.boomEase = [CustomTimeInterpolator new];

Check demo for more details.

Ease Enum

There are 31 kinds of ease animations. Check the Ease file to try all the enums.

Home
Chapters

  1. Basic Usage
  2. Simple Circle Button
  3. Text Inside Circle Button
  4. Text Outside Circle Button
  5. Ham Button
  6. Share Style
  7. Custom Position
  8. Button Place Alignments
  9. Different Ways to Boom
  10. Ease Animations for Buttons
  11. Different Order for Buttons
  12. Other Animations Attributes for Buttons
  13. Click Event and Listener
  14. Control BMB
  15. Use BMB in Navigation Bar
  16. Use BMB in Table View
  17. Attributes for BMB or Pieces on BMB
  18. Cache Optimization & Boom Area
  19. Change Boom Buttons Dynamically
  20. Blur Background & Tip
  21. Fade Views
  22. Structure of BMB
  23. Version History
Clone this wiki locally