-
Notifications
You must be signed in to change notification settings - Fork 112
Ease Animations for Buttons (Swift)

Use different and cute ease-animations for buttons.
Swift | Objective-C
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.
-
Move animation when booming.
bmb.boomMoveEaseName = Ease.inBack
The default value is
Ease.outBack
-
Rotate animation when booming.
bmb.boomRotateEaseName = Ease.inBack
The default value is
Ease.outBack
-
Scale animation when booming.
bmb.boomScaleEaseName = Ease.linear
The default value is
Ease.outBack
-
Move animation when re-booming.
bmb.reboomMoveEaseName = Ease.inBack
The default value is
Ease.inBack
-
Rotate animation when re-booming.
bmb.reboomRotateEaseName = Ease.inBack
The default value is
Ease.inBack
-
Scale animation when re-booming.
bmb.reboomScaleEaseName = Ease.inBack
The default value is
Ease.inBack
You can change movement, scale and rotation animations’ ease name with a line of code:
bmb.boomEaseName = Ease.outCirc
bmb.reboomEaseName = Ease.outCirc
Or if you want a customized ease:
class CustomTimeInterpolator: TimeInterpolator {
func interpolation(_ offset: CGFloat) -> CGFloat {
return offset < 0.5 ? offset : min(offset * 1.5, 1)
}
}
...
bmb.boomEase = CustomTimeInterpolator.init()
Check demo for more details.
There are 31 kinds of ease animations. Check the Ease file to try all the enums.

Home
Chapters
- Basic Usage
- Simple Circle Button
- Text Inside Circle Button
- Text Outside Circle Button
- Ham Button
- Share Style
- Custom Position
- Button Place Alignments
- Different Ways to Boom
- Ease Animations for Buttons
- Different Order for Buttons
- Other Animations Attributes for Buttons
- Click Event and Listener
- Control BMB
- Use BMB in Navigation Bar
- Use BMB in Table View
- Attributes for BMB or Pieces on BMB
- Cache Optimization & Boom Area
- Change Boom Buttons Dynamically
- Blur Background & Tip
- Fade Views
- Structure of BMB
- Version History