Giter Site home page Giter Site logo

motionlayoutfabanimation's Introduction

MotionLayoutFABAnimation

  • A versatile FAB button and card animation which inherently involves stateful transformations of your compose views, and maintaining visual aesthetics necessitate the following attributes:
    • Seamlessness
    • Smooth
    • Reentrant

Types of Reveal animations

Animation Type Preview
CIRCULAR_REVEAL image
FADE_REVEAL image
ROTATION_REVEAL image
SCALE_REVEAL image
SLIDE_IN_FROM_BOTTOM image

Key features

  • Smooth Transitions made with MotionLayout
  • Aesthetical Animations
  • Customizable Animations
  • Performance-Optimized Animations
  • Intuitive Animation Controls

Layout ids to hook your FAB with predefined motion script

#Option:1 - Without FAB transition effect You need to make use of layoutId modifier in order to hook your composable with the motion scene and the rest will be taken care of!

mi_single_fab
image

#Option:2 - With FAB transition effect In order to achieve a cross-fade animation effect with FAB, which would enable one image to get transitioned into another during the FAB progression

mi_fab_start mi_fab_end
image image

Attributes

Attribute Description
circularRevealAnimationVal To handle circular reveal animation
animateButtonVal To manage the state of a FAB button
cardComposable Pass your custom composable, which will be integrated into a card content post-reveal animation
fabComposable Pass your custom composable, which will be shown as a Floating Action Button
hideFabPostAnimationVal To hide FAB once the animation is done
fabAnimationDur To manage the animation duration of FAB
revealAnimDur To manage the animation duration of reveal animation
fabCloseDelay To adjust closing animation duration in order to make reveal animation smooth
animationType Enum to set the type of animation which is mentioned in the "Types of Reveal animations" section
overlayBackgroundColor To pass color which would set as an overlay background

How to use it? ๐Ÿค”

  1. Add this to your root build.gradle at the end of repositories:
allprojects {
          repositories {
              maven { url 'https://jitpack.io' }
          }
}
  1. Add the dependency in your app's build.gradle file:
dependencies {
    implementation 'com.github.Mindinventory:FabCardReveal:X.X.X'
}
  1. How to Implement: At the outset, we require few states to manage our animations smoothly which you can handle from your custom composable.

To handle circular reveal animation

val revealAnimation = remember { mutableStateOf(false) }

To manage the state of a FAB button

val animateButton = remember { mutableStateOf(false) }

To hide FAB post completion of it's animation

val animateButton = remember { mutableStateOf(false) }
CircularRevealAnimation(
  circularRevealAnimationVal = revealAnimation,
  animateButtonVal = animateButton,
  cardComposable = {
    YourCardComposableHandler {
      revealAnimation.value = false  //To trigger card closing animation
    }
},
fabComposable = {
  YourFabAnimationHandler()
},
hideFabPostAnimationVal = hideFabPostAnimation,
fabAnimationDur = 800,
revealAnimDur = 800,
fabCloseDelay = 800,  
animationType = AnimationType.CIRCULAR_REVEAL,
overlayBackgroundColor = MattePurple.copy(alpha = 0.8f)
)

LICENSE!

FabCardReveal is MIT-licensed.

Let us know!

We'd be delighted to receive links to your projects showcasing our component in action! Simply drop us an email at [email protected]. If you have any questions or suggestions concerning our work, we'd love to hear from you. Your feedback is important to us!

app development

motionlayoutfabanimation's People

Contributors

vrajendrabhavsar 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.