Connect with us

Code

Metaphor: Material Motion animations

Metaphor is the library to easily add Material Motion animations.

Metaphor provides support for all four motion patterns defined in the Material spec.

  1. Container transform
  2. Shared axis
  3. Fade through
  4. Fade

Example – Container transform:

//Start Fragments onclick// 
val extras = FragmentNavigatorExtras(view to item.pos.toString())
      val action = ArtistListFragmentDirections.navToCharacterDetailFragment(item)
      findNavController().navigate(action, extras)
		
//start fragment 
metaphorStartFragmentMaterialContainerTransform(view)// inside on onviewcreated  ////it also retuns the object of MaterialContainerTransform() you can use .apply { } to change values

//destination fragment		
metaphorDestinationFragmentMaterialContainerTransform(view, args.data.pos.toString())// inside onviewcreated ////it also retuns the object of MaterialContainerTransform() you can use .apply { } to change values


Metaphor on GitHub: https://github.com/AndroidPoet/Metaphor
Platform: Android
⭐️: 14

 

Advertisement

Trending