Material Motion for Jetpack Compose

Overview

logo

Material Motion for Jetpack Compose

Jetpack Compose library for implementing motion system in Material Components for Android.

🌈 Core

A library which provides motion patterns support for Jetpack Compose.

🧭 Navigation

A library which provides motion patterns support for Jetpack Navigation Compose.

License

Licensed under the Apache 2.0 license. See LICENSE for details.

Comments
  • Weird back stack motion behavior on nested graph

    Weird back stack motion behavior on nested graph

    I have 4 navigation routes: first, second, third, fourth.

    When i try to navigate first -> second -> third -> fourth, the transitions behave normally as it should.

    However when i try to navigate back (back press) first <- second <- third <- fourth, the only transition that behave normally is the first pop backstack (in this case third <- fourth), other pop backstack just overlaps the current backstack.

    I'm not sure how to explain it well but i have included a sample project for testing it here and a video here

    opened by uragiristereo 7
  • Integration with navigation-compose

    Integration with navigation-compose

    It is expected that transition animations can be applied to navigation-compose after some time. The following link is related to this.

    • https://issuetracker.google.com/issues/172112072

    Then, it seems that it needs to be changed to a form that can be combined with navigation-compose.

    enhancement 
    opened by fornewid 4
  • navigation.navigateUp() returns to first route instead the previous route

    navigation.navigateUp() returns to first route instead the previous route

    Describe the bug

    On v0.7.4, the back press behavior issue is fixed but when using navigation.navigateUp() it still occured.

    To Reproduce

    I have 3 routes, for example: splash, main, search. When i'm navigating splash -> main -> search, i called navigation.navigateUp() on search. It returns to main then splash reappears again.

    Expected behavior

    The splash route should not reappears after calling navigation.navigateUp() on search.

    Environment

    • Android OS version: Android 10
    • Device: Xiaomi Mi A2
    • material-motion-compose version: 0.7.4

    Additional context

    Add any other context about the problem here.

    opened by uragiristereo 3
  • Navigation Usage sample does not work?

    Navigation Usage sample does not work?

    Describe the bug

    The navigation sample usage does not actually work, as rememberSlideDistance() cannot be called from the lambda, it needs to be in a composable function

    To Reproduce

    Steps to reproduce the behavior: Implement the usage sample

    Expected behavior

    It works

    bug 
    opened by jonschmidt 2
  • Use explicit API mode

    Use explicit API mode

    Explicit API mode:

    • https://kotlinlang.org/docs/whatsnew14.html#explicit-api-mode-for-library-authors
    • https://chao2zhang.medium.com/explicit-api-mode-for-kotlin-on-android-b8264fdd76d1

    @JvmSynthetic:

    • https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-synthetic/
    • https://speakerdeck.com/skydoves/designing-robust-apis-in-kotlin?slide=24

    Excludes Explicit API mode for test codes:

    • https://youtrack.jetbrains.com/issue/KT-37652
    • https://chao2zhang.medium.com/explicit-api-mode-for-kotlin-on-android-b8264fdd76d1

    Import version catalogs into buildSrc:

    • https://docs.gradle.org/7.4/userguide/platforms.html#sec:importing-catalog-from-file
    opened by fornewid 1
  • Introduce `circularReveal` modifier

    Introduce `circularReveal` modifier

    Example Codes

    var visible: Boolean by remember { mutableStateOf(false) }
    Box(
        modifier = Modifier.circularReveal(
            visible = visible,
            center = { fullSize ->
                Offset(x = 1f * fullSize.width, y = 0f * fullSize.height) // TopRight
            },
        )
    ) { ... }
    

    https://user-images.githubusercontent.com/3405740/176953579-4704985a-706a-4681-b41d-123067c2719f.mp4

    References

    • https://gist.github.com/darvld/eb3844474baf2f3fc6d3ab44a4b4b5f8
    • https://gist.github.com/ErfanSn/f3283d2b22b78fe4ad9b0791c4370e2c
    opened by fornewid 0
  • Use explicit API on warning mode

    Use explicit API on warning mode

    Explicit API mode:

    • https://kotlinlang.org/docs/whatsnew14.html#explicit-api-mode-for-library-authors
    • https://chao2zhang.medium.com/explicit-api-mode-for-kotlin-on-android-b8264fdd76d1
    opened by fornewid 0
  • Migrate to KMP

    Migrate to KMP

    • https://kotlinlang.org/docs/multiplatform-library.html
    • https://dev.to/kotlin/how-to-build-and-publish-a-kotlin-multiplatform-library-creating-your-first-library-1bp8
    • https://stackoverflow.com/questions/61175395/jitpack-and-kotlin-multiplatform-artifact-groupid
    opened by fornewid 0
  • Add sample for Desktop Compose

    Add sample for Desktop Compose

    • https://www.jetbrains.com/lp/compose/
    • https://github.com/JetBrains/compose-jb/blob/master/tutorials/Getting_Started/README.md
    • https://github.com/JetBrains/compose-jb/commit/3b13944daf52118e2226cad91a5f2144b8b295b1
    • https://github.com/androidx/androidx/blob/androidx-main/compose/material/material/build.gradle
    • https://github.com/AAkira/Napier/blob/master/napier/build.gradle.kts
    opened by fornewid 0
Releases(v0.11.0-alpha)
  • v0.11.0-alpha(Oct 30, 2022)

  • v0.10.3(Oct 30, 2022)

    Built to work with Jetpack Compose 1.3.0

    What’s Changed

    • Updates to Compose 1.3.0 and Compose Compiler 1.3.2 (#175) @fornewid
    • Avoid crashing when the start destination changes (#176) @fornewid
    Source code(tar.gz)
    Source code(zip)
  • v0.10.2-beta(Oct 30, 2022)

  • v0.10.1-alpha(Aug 18, 2022)

    Built to work with Jetpack Compose 1.3.0-alpha03

    What’s Changed

    • Updates to Compose 1.3.0-alpha03 and Compose Compiler 1.3.0 (#173) @fornewid
    • Updates to Compose 1.3.0-alpha02 and Compose Compiler 1.3.0-rc01 (#171) @fornewid
    Source code(tar.gz)
    Source code(zip)
  • v0.9.1(Aug 18, 2022)

  • v0.9.0(Jul 28, 2022)

  • v0.10.0-alpha(Jul 3, 2022)

    Built to work with Jetpack Compose 1.3.0-alpha01

    Key Changes

    🌈 [Core] Introduce new circularReveal modifier in 'core' library!

    var visible: Boolean by remember { mutableStateOf(false) }
    Box(
        modifier = Modifier.circularReveal(
            visible = visible,
            center = { fullSize ->
                Offset(x = 1f * fullSize.width, y = 0f * fullSize.height) // TopRight
            },
        )
    ) { ... }
    

    For the full codes, refer to CircularRevealScreen.kt file.


    🧭 [Navigation] Easy migration from accompanist-navigation-animation!

    With this version, you can easily migrate to this library from accompanist-navigation-animation. If you are interested, check out the migration guide. 😉

    🧭 [Navigation] The 'core' library dependency is no longer needed!

      dependencies {
          implementation "io.github.fornewid:material-motion-compose-navigation:<version>"
    -     implementation "io.github.fornewid:material-motion-compose-core:<version>"
      }
    

    Breaking Changes

    ⚠️ MotionSpec is deprecated and use ContentTransform instead

    If you were already using this library, you must migrate your codes. Please check out the migration guide.

    What’s Changed

    • Add sample codes using accompanist-navigation-animation library (#169) @fornewid
    • Deprecate MotionSpec (#168) @fornewid
    • Updates to Compose 1.3.0-alpha01 (#167) @fornewid
    • Introduce circularReveal modifier (#166) @fornewid
    • Clean up sample codes (#165) @fornewid
    Source code(tar.gz)
    Source code(zip)
  • v0.9.0-rc03(Jul 1, 2022)

  • v0.9.0-rc02(Jun 23, 2022)

  • v0.9.0-rc01(Jun 16, 2022)

  • v0.9.0-beta03(Jun 2, 2022)

  • 0.9.0-beta02(May 19, 2022)

  • 0.9.0-beta01(May 12, 2022)

    Built to work with Jetpack Compose 1.2.0-beta01

    What’s Changed

    • Updates to Compose 1.2.0-beta01 (#156) @fornewid
    • Android Studio Chipmunk | 2021.2.1 (#155) @fornewid
    • Remove compose-material dependency from library modules (#154) @fornewid
    • Add API files using metalava (#153) @fornewid
    • Create CODEOWNERS (#151) @fornewid
    • Merge 'preview' to 'main' (#150) @fornewid
    • Merge 'preview' to 'main' (#149) @fornewid
    • Update README.md (#148) @fornewid
    Source code(tar.gz)
    Source code(zip)
  • 0.9.0-alpha09(May 3, 2022)

    Built to work with Jetpack Compose 1.2.0-alpha08

    Breaking changes

    Now 'Material Motion for Jetpack Compose' is available on Maven Central! :tada: :tada: :tada:

      repositories {
    -     maven { url "https://jitpack.io" }
    +     mavenCentral()
      }
      dependencies {
    -     implementation "com.github.fornewid.material-motion-compose:core:<version>"
    +     implementation "io.github.fornewid:material-motion-compose-core:<version>"
    
    -     implementation "com.github.fornewid.material-motion-compose:navigation:<version>"
    +     implementation "io.github.fornewid:material-motion-compose-navigation:<version>"
      }
    

    What’s Changed

    • Update README.md (#148) @fornewid
    • Prepare deployment to Maven Central (#146) @fornewid
    Source code(tar.gz)
    Source code(zip)
  • 0.8.4(May 3, 2022)

    Built to work with Jetpack Compose 1.1.1

    Breaking changes

    Now 'Material Motion for Jetpack Compose' is available on Maven Central! :tada: :tada: :tada:

      repositories {
    -     maven { url "https://jitpack.io" }
    +     mavenCentral()
      }
      dependencies {
    -     implementation "com.github.fornewid.material-motion-compose:core:<version>"
    +     implementation "io.github.fornewid:material-motion-compose-core:<version>"
    
    -     implementation "com.github.fornewid.material-motion-compose:navigation:<version>"
    +     implementation "io.github.fornewid:material-motion-compose-navigation:<version>"
      }
    

    What’s Changed

    • Update README.md (#147) @fornewid
    • Prepare deployment to Maven Central (#145) @fornewid
    Source code(tar.gz)
    Source code(zip)
  • 0.9.0-alpha08(May 1, 2022)

    Built to work with Jetpack Compose 1.2.0-alpha08

    Breaking changes

    (1) Add AnimatedContentScope and AnimatedVisiblityScope in MaterialMotion.

          MaterialMotion(
              targetState = state,
    -         motionSpec = when (state.motionSpecType) {
    -             MotionSpecType.SharedAxis -> materialSharedAxisY()
    -             MotionSpecType.FadeThrough -> materialFadeThrough()
    -         }
    +         motionSpec = {
    +             when (targetState.motionSpecType) {
    +                 MotionSpecType.SharedAxis -> materialSharedAxisY()
    +                 MotionSpecType.FadeThrough -> materialFadeThrough()
    +             }
    +         }
          ) { currentState ->
    

    (2) Add AnimatedContentScope and AnimatedVisiblityScope in MaterialMotionNavHost.

        MaterialMotionNavHost(
            navController,
            startDestination = "library",
    -       enterMotionSpec = { _, _ -> translateXIn({ it }) },
    -       exitMotionSpec = { _, _ -> materialElevationScaleOut() },
    -       popEnterMotionSpec = { _, _ -> materialElevationScaleIn() },
    -       popExitMotionSpec = { _, _ -> translateXOut({ it }) }
    +       enterMotionSpec = { translateXIn({ it }) },
    +       exitMotionSpec = { materialElevationScaleOut() },
    +       popEnterMotionSpec = { materialElevationScaleIn() },
    +       popExitMotionSpec = { translateXOut({ it }) }
        ) {
            composable(
                "first",
    -           enterMotionSpec = { _, _ -> holdIn() },
    -           exitMotionSpec = { _, _ -> holdOut() },
    +           enterMotionSpec = { holdIn() },
    +           exitMotionSpec = { holdOut() },
            ) { ... }
    
            navigation(
                "second",
                "subGraph",
    -           enterMotionSpec = { _, _ -> translateYIn({ it }) },
    -           exitMotionSpec = { _, _ -> translateYOut({ it }) },
    +           enterMotionSpec = { translateYIn({ it }) },
    +           exitMotionSpec = { translateYOut({ it }) },
            ) {
                composable("second") { ... }
            }
        }
    

    (3) Lambdas in Enter/ExitMotionSpec factories have been moved to the last position in the param list.

    -  translateXIn({ it })
    +  translateXIn { it }
    
    -  translateXOut({ it })
    +  translateXOut { it }
    
    -  translateYIn({ it })
    +  translateYIn { it }
    
    -  translateYOut({ it })
    +  translateYOut { it }
    

    What’s Changed

    • Migrate buildSrc to Version Catalog (#144) @fornewid
    • [Navigation] Fix Nested NavHost animations (#142) @fornewid
    • [Core] Graduate Enter/ExitMotionSpec from experimental (#141) @fornewid
    • [Navigation] Add AnimatedContentScope and AnimatedVisiblityScope (#136) @fornewid
    • Update to Android Gradle Plugin 7.1.3 (#139) @fornewid
    • [Core] Support custom keys in MaterialMotion (#135) @fornewid
    • [Core] Support AnimatedContentScope in MaterialMotion (#133) @fornewid
    • [Navigation] Allow nested NavGraphs to take args and deeplinks (#131) @fornewid
    • Make visible entries a set (#129) @fornewid
    • Fix destination animations being ignored (#127) @fornewid
    • [Navigation] Disallow null animations on MaterialMotionNavHost (#123) @fornewid
    • Correcting the docs for Navigation (#125) @fornewid
    • Updates to Compose 1.2.0-alpha08 (#121) @fornewid
    Source code(tar.gz)
    Source code(zip)
  • 0.8.3(May 1, 2022)

    Built to work with Jetpack Compose 1.1.1

    Breaking changes

    (1) Add AnimatedContentScope and AnimatedVisiblityScope in MaterialMotion.

          MaterialMotion(
              targetState = state,
    -         motionSpec = when (state.motionSpecType) {
    -             MotionSpecType.SharedAxis -> materialSharedAxisY()
    -             MotionSpecType.FadeThrough -> materialFadeThrough()
    -         }
    +         motionSpec = {
    +             when (targetState.motionSpecType) {
    +                 MotionSpecType.SharedAxis -> materialSharedAxisY()
    +                 MotionSpecType.FadeThrough -> materialFadeThrough()
    +             }
    +         }
          ) { currentState ->
    

    (2) Add AnimatedContentScope and AnimatedVisiblityScope in MaterialMotionNavHost.

        MaterialMotionNavHost(
            navController,
            startDestination = "library",
    -       enterMotionSpec = { _, _ -> translateXIn({ it }) },
    -       exitMotionSpec = { _, _ -> materialElevationScaleOut() },
    -       popEnterMotionSpec = { _, _ -> materialElevationScaleIn() },
    -       popExitMotionSpec = { _, _ -> translateXOut({ it }) }
    +       enterMotionSpec = { translateXIn({ it }) },
    +       exitMotionSpec = { materialElevationScaleOut() },
    +       popEnterMotionSpec = { materialElevationScaleIn() },
    +       popExitMotionSpec = { translateXOut({ it }) }
        ) {
            composable(
                "first",
    -           enterMotionSpec = { _, _ -> holdIn() },
    -           exitMotionSpec = { _, _ -> holdOut() },
    +           enterMotionSpec = { holdIn() },
    +           exitMotionSpec = { holdOut() },
            ) { ... }
    
            navigation(
                "second",
                "subGraph",
    -           enterMotionSpec = { _, _ -> translateYIn({ it }) },
    -           exitMotionSpec = { _, _ -> translateYOut({ it }) },
    +           enterMotionSpec = { translateYIn({ it }) },
    +           exitMotionSpec = { translateYOut({ it }) },
            ) {
                composable("second") { ... }
            }
        }
    

    (3) Lambdas in Enter/ExitMotionSpec factories have been moved to the last position in the param list.

    -  translateXIn({ it })
    +  translateXIn { it }
    
    -  translateXOut({ it })
    +  translateXOut { it }
    
    -  translateYIn({ it })
    +  translateYIn { it }
    
    -  translateYOut({ it })
    +  translateYOut { it }
    

    What’s Changed

    • Migrate buildSrc to Version Catalog (#143) @fornewid
    • [Core] Graduate Enter/ExitMotionSpec from experimental (#140) @fornewid
    • [Navigation] Add AnimatedContentScope and AnimatedVisiblityScope (#137) @fornewid
    • Update to Android Gradle Plugin 7.1.3 (#138) @fornewid
    • [Core] Support custom keys in MaterialMotion (#134) @fornewid
    • [Core] Support AnimatedContentScope in MaterialMotion (#132) @fornewid
    • [Navigation] Allow nested NavGraphs to take args and deeplinks (#130) @fornewid
    • Make visible entries a set (#128) @fornewid
    • Fix destination animations being ignored (#126) @fornewid
    • [Navigation] Disallow null animations on MaterialMotionNavHost (#122) @fornewid
    • Correcting the docs for Navigation (#124) @fornewid
    Source code(tar.gz)
    Source code(zip)
  • 0.9.0-alpha07(Apr 28, 2022)

  • 0.9.0-alpha06(Apr 28, 2022)

  • 0.9.0-alpha05(Apr 28, 2022)

    Built to work with Jetpack Compose 1.2.0-alpha05

    What’s Changed

    • Updates to Compose 1.2.0-alpha05 (#118) @fornewid
    • [Core] Fix that Content z-Index is reversed at the 'backward' motion (#117) @fornewid
    Source code(tar.gz)
    Source code(zip)
  • 0.8.2(Apr 27, 2022)

  • 0.9.0-alpha04(Feb 24, 2022)

  • 0.8.1(Feb 24, 2022)

  • 0.9.0-alpha03(Feb 15, 2022)

  • 0.9.0-alpha02(Feb 13, 2022)

  • 0.9.0-alpha01(Feb 13, 2022)

  • 0.8.0(Feb 12, 2022)

  • 0.8.0-rc03(Feb 5, 2022)

  • 0.8.0-rc01(Dec 16, 2021)

  • 0.8.0-beta04(Dec 2, 2021)

Owner
Sungyong An (SOUP)
Android Developer at @webtoon. 🇰🇷
Sungyong An (SOUP)
A simple 'Slide to Unlock' Material widget for Android, written in Jetpack Compose

SlideTodo A simple 'Slide to Unlock' Material widget for Android, written in Jetpack Compose you can find source code here Getting Started allprojects

Nthily 7 Aug 8, 2022
A library that enables reuse of Material themes defined in XML for theming in Jetpack Compose.

MDC-Android Compose Theme Adapter A library that enables reuse of Material Components for Android XML themes for theming in Jetpack Compose. The basis

Material Components 409 Dec 24, 2022
A lightweight library for using Material Colors in Android Jetpack Compose Project 🚀🚀🚀

How To Use Step 1: Add the JitPack repository to your build file. Add it in your root build.gradle / build.gradle.kts at the end of repositories: Groo

Atick Faisal 9 Sep 9, 2022
A Jetpack Compose implementation of Owl, a Material Design study

Owl sample This sample is a Jetpack Compose implementation of Owl, a Material De

Alexander 1 Feb 26, 2022
ToDo-Task-App - An Android App built to demonstrate the use of Jetpack Compose, Material You, Room Database, and MVVM

ToDo Task App ToDo Task App is a sample Android app built with Jetpack Compose.

null 0 Jan 17, 2022
Material You using Jetpack Compose

Material You using Jetpack Compose. How to keep M2 alongside with M3 in a project. Repo to play with Material Themes and MDC

Luis Barqueira 3 Jul 28, 2022
A setting library for Jetpack Compose with Material You design

ComposeSetting This is a basic Compose setting library that provides a basic Material3 setting components It also provides a persistent state system b

RE 13 Nov 10, 2022
Jetpack Compose Boids | Flocking Insect 🐜. bird or Fish simulation using Jetpack Compose Desktop 🚀, using Canvas API 🎨

?? ?? ?? Compose flocking Ants(boids) ?? ?? ?? Jetpack compose Boids | Flocking Insect. bird or Fish simulation using Jetpack Compose Desktop ?? , usi

Chetan Gupta 38 Sep 25, 2022
A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Why Not Compose! A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Md. Mahmudul Hasan Shohag 186 Jan 1, 2023
Learn Jetpack Compose for Android by Examples. Learn how to use Jetpack Compose for Android App Development. Android’s modern toolkit for building native UI.

Learn Jetpack Compose for Android by Examples. Learn how to use Jetpack Compose for Android App Development. Android’s modern toolkit for building native UI.

MindOrks 382 Jan 5, 2023
This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Compose.

JetBMICalculator This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Co

BHAVNA THACKER 3 Dec 31, 2022
Jetpack-Compose-Demo - Instagram Profile UI using Jetpack Compose

Jetpack-Compose-Demo Instagram Profile UI using Jetpack Compose

omar 1 Aug 11, 2022
Jetpack-compose-animations-examples - Cool animations implemented with Jetpack compose

Jetpack-compose-animations-examples This repository consists of 4 animations: St

Canopas Software 180 Jan 2, 2023
Compose-navigation - Set of utils to help with integrating Jetpack Compose and Jetpack's Navigation

Jetpack Compose Navigation Set of utils to help with integrating Jetpack Compose

Adam Kobus 5 Apr 5, 2022
Jetpack-compose-uis - A collection of some UIs using Jetpack Compose. built using Katalog

Jetpack Compose UIs This is a collection of some UIs using Jetpack Compose. It i

Mori Atsushi 3 Dec 15, 2022
A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose

Authentication A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose Scree

Felix Kariuki 5 Dec 29, 2022
An application that i developed with a aim of learning Jetpack compose and many other jetpack libraries

An application that i developed with a aim of learning Jetpack compose and many other jetpack libraries, The application make use of jikan Api which displays a list of animations,there more details and even trailers of the animations.

Odhiambo Brandy 10 Nov 23, 2022
A Kotlin library to use Jetpack Compose in Android and iOS. Allow to write UI for both in Kotin. Still experimental as many compose features are not yet available.

Multiplatform Compose A Kotlin library to use Jetpack Compose in Android and iOS. Allow to write UI for both in Kotin. Still experimental as many comp

ClĂŠment Beffa 548 Jan 7, 2023
K5-compose is a sketchy port of p5.js for Jetpack Compose

k5-compose k5-compose is a sketchy port of P5.js for Jetpack Compose Desktop. This library provides you a playground to play with your sketches so you

Nikhil Chaudhari 176 Nov 22, 2022