-
Notifications
You must be signed in to change notification settings - Fork 112
Ease Animations for Buttons (Objective C)
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 = VHEaseInBack;
The default value is
VHEaseOutBack
-
Rotate animation when booming.
bmb.boomRotateEaseName = VHEaseInBack;
The default value is
VHEaseOutBack
-
Scale animation when booming.
bmb.boomScaleEaseName = VHEaseLinear;
The default value is
VHEaseOutBack
-
Move animation when re-booming.
bmb.reboomMoveEaseName = VHEaseInBack;
The default value is
VHEaseInBack
-
Rotate animation when re-booming.
bmb.reboomRotateEaseName = VHEaseInBack;
The default value is
VHEaseInBack
-
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.
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