├── .github └── workflows │ └── apk.yml ├── .gitignore ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wajahatkarim3 │ │ └── droidcon │ │ └── emea2020 │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── wajahatkarim3 │ │ │ └── animations │ │ │ └── demo │ │ │ ├── AnimateContentDemos.kt │ │ │ ├── AnimateDpDemos.kt │ │ │ ├── AnimatedValues.kt │ │ │ ├── AnimatedVisibilityDemos.kt │ │ │ ├── CircleMenu.kt │ │ │ ├── FlipView.kt │ │ │ ├── MainActivity.kt │ │ │ ├── RWButton.kt │ │ │ ├── TransitionsDemo.kt │ │ │ └── ui │ │ │ ├── Color.kt │ │ │ ├── Shape.kt │ │ │ ├── Theme.kt │ │ │ └── Type.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── card_back.png │ │ ├── card_front.png │ │ ├── female.jpg │ │ ├── ic_launcher_background.xml │ │ └── male.jpg │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── com │ └── wajahatkarim3 │ └── droidcon │ └── emea2020 │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.github/workflows/apk.yml: -------------------------------------------------------------------------------- 1 | name: Generate APK 2 | on: 3 | push: 4 | branches: [ main ] 5 | 6 | jobs: 7 | # Run Unit Tests etc before Generating APK here. 8 | # .... 9 | 10 | # A job to generate debug APK and upload on Github Artifacts 11 | apk: 12 | name: Generate APK 13 | runs-on: ubuntu-18.04 14 | 15 | steps: 16 | - uses: actions/checkout@v1 17 | - name: set up JDK 18 | uses: actions/setup-java@v1 19 | with: 20 | java-version: 11.0.3 21 | 22 | - name: Grant Permission to Execute 23 | run: chmod +x gradlew 24 | 25 | - name: Build debug APK 26 | run: bash ./gradlew assembleDebug --stacktrace 27 | 28 | - name: Upload APK to Github Artifacts 29 | uses: actions/upload-artifact@v1 30 | with: 31 | name: app 32 | path: app/build/outputs/apk/debug/app-debug.apk 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.aar 4 | *.ap_ 5 | *.aab 6 | 7 | # Files for the ART/Dalvik VM 8 | *.dex 9 | 10 | # Java class files 11 | *.class 12 | 13 | # Generated files 14 | bin/ 15 | gen/ 16 | out/ 17 | # Uncomment the following line in case you need and you don't have the release build type files in your app 18 | # release/ 19 | 20 | # Gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Local configuration file (sdk path, etc) 25 | local.properties 26 | 27 | # Proguard folder generated by Eclipse 28 | proguard/ 29 | 30 | # Log Files 31 | *.log 32 | 33 | # Android Studio Navigation editor temp files 34 | .navigation/ 35 | 36 | # Android Studio captures folder 37 | captures/ 38 | 39 | # IntelliJ 40 | *.iml 41 | .idea/workspace.xml 42 | .idea/tasks.xml 43 | .idea/gradle.xml 44 | .idea/assetWizardSettings.xml 45 | .idea/dictionaries 46 | .idea/libraries 47 | # Android Studio 3 in .gitignore file. 48 | .idea/caches 49 | .idea/modules.xml 50 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 51 | .idea/navEditor.xml 52 | 53 | # Keystore files 54 | # Uncomment the following lines if you do not want to check your keystore files in. 55 | #*.jks 56 | #*.keystore 57 | 58 | # External native build folder generated in Android Studio 2.2 and later 59 | .externalNativeBuild 60 | .cxx/ 61 | 62 | # Google Services (e.g. APIs or Firebase) 63 | # google-services.json 64 | 65 | # Freeline 66 | freeline.py 67 | freeline/ 68 | freeline_project_description.json 69 | 70 | # fastlane 71 | fastlane/report.xml 72 | fastlane/Preview.html 73 | fastlane/screenshots 74 | fastlane/test_output 75 | fastlane/readme.md 76 | 77 | # Version control 78 | vcs.xml 79 | 80 | # lint 81 | lint/intermediates/ 82 | lint/generated/ 83 | lint/outputs/ 84 | lint/tmp/ 85 | # lint/reports/ 86 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Compose Animations Demo 2 | Demo codes for "Animating Your Jetpack Compose Apps" talk about Jetpack Compose and Animations 3 | 4 | Slides: https://slides.com/wajahatkarim/jetpack-compose-for-games-animations 5 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 33 8 | buildToolsVersion "30.0.3" 9 | 10 | defaultConfig { 11 | applicationId "com.wajahatkarim3.animations.demo" 12 | minSdkVersion 21 13 | targetSdkVersion 33 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | kotlinOptions { 31 | jvmTarget = '1.8' 32 | freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn" 33 | } 34 | buildFeatures { 35 | compose true 36 | } 37 | 38 | composeOptions { 39 | kotlinCompilerExtensionVersion = "$compose_version" 40 | } 41 | } 42 | 43 | dependencies { 44 | 45 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" 46 | implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" 47 | implementation 'androidx.core:core-ktx:1.9.0' 48 | implementation 'androidx.appcompat:appcompat:1.5.1' 49 | implementation 'com.google.android.material:material:1.7.0' 50 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 51 | implementation "androidx.compose.ui:ui:$compose_version" 52 | implementation "androidx.compose.ui:ui-tooling:$compose_version" 53 | implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" 54 | implementation "androidx.compose.material:material:1.3.1" 55 | implementation "androidx.compose.runtime:runtime-livedata:$compose_version" 56 | implementation "androidx.activity:activity-compose:1.6.1" 57 | implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1' 58 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/com/wajahatkarim3/droidcon/emea2020/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.droidcon.emea2020 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.wajahatkarim3.droidcon.emea2020", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/AnimateContentDemos.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo 2 | 3 | import android.util.Log 4 | import androidx.compose.animation.animateContentSize 5 | import androidx.compose.animation.core.* 6 | import androidx.compose.foundation.background 7 | import androidx.compose.foundation.clickable 8 | import androidx.compose.foundation.layout.* 9 | import androidx.compose.foundation.shape.RoundedCornerShape 10 | import androidx.compose.material.Button 11 | import androidx.compose.material.Text 12 | import androidx.compose.runtime.Composable 13 | import androidx.compose.runtime.mutableStateOf 14 | import androidx.compose.runtime.remember 15 | import androidx.compose.ui.Modifier 16 | import androidx.compose.ui.graphics.Color 17 | import androidx.compose.ui.text.TextStyle 18 | import androidx.compose.ui.unit.dp 19 | import androidx.compose.runtime.getValue 20 | import androidx.compose.runtime.setValue 21 | 22 | @Composable 23 | fun AnimateContentSizeDemo() { 24 | Column( 25 | Modifier.wrapContentHeight() 26 | .padding(20.dp) 27 | .background(Color.Gray) 28 | .fillMaxWidth() 29 | .padding(20.dp) 30 | ) { 31 | ExpandableText() 32 | Spacer(Modifier.height(20.dp)) 33 | ExpandableButton() 34 | Spacer(Modifier.height(20.dp)) 35 | PortraitModeImage() 36 | Spacer(Modifier.height(150.dp)) 37 | } 38 | } 39 | 40 | @Composable 41 | fun ExpandableText() { 42 | val shortText = "Click me" 43 | val longText = "Very long text passage that spans\nacross multiple lines, paragraphs\nand pages" 44 | var short by remember { mutableStateOf(true) } 45 | Box( 46 | modifier = Modifier 47 | .background( 48 | Color.Blue, 49 | RoundedCornerShape(15.dp) 50 | ) 51 | .clickable { short = !short } 52 | .padding(20.dp) 53 | .wrapContentSize() 54 | .animateContentSize() 55 | ) { 56 | Text( 57 | if (short) { 58 | shortText 59 | } else { 60 | longText 61 | }, 62 | style = TextStyle(color = Color.White) 63 | ) 64 | } 65 | } 66 | 67 | @Composable 68 | fun ExpandableButton() { 69 | val shortText = "Short" 70 | val longText = "Very loooooong text" 71 | var short by remember { mutableStateOf(true) } 72 | Button( 73 | { short = !short } 74 | ) { 75 | Text( 76 | if (short) { 77 | shortText 78 | } else { 79 | longText 80 | }, 81 | style = TextStyle(color = Color.White), 82 | modifier = Modifier.animateContentSize() 83 | ) 84 | } 85 | } 86 | 87 | @Composable 88 | fun PortraitModeImage() { 89 | var portraitMode by remember { mutableStateOf(true) } 90 | Box( 91 | Modifier.clickable { portraitMode = !portraitMode } 92 | .sizeIn(maxWidth = 300.dp, maxHeight = 300.dp) 93 | .background(if (portraitMode) Color(0xFFfffbd0) else Color(0xFFe3ffd9)) 94 | .animateContentSize( 95 | animationSpec = tween(500, easing = LinearEasing), 96 | finishedListener = { startSize, endSize -> 97 | Log.d("droidcon", "$startSize -> $endSize") 98 | } 99 | ) 100 | .aspectRatio(if (portraitMode) 3 / 4f else 16 / 9f) 101 | ) { 102 | Text( 103 | if (portraitMode) { 104 | "3 : 4" 105 | } else { 106 | "16 : 9" 107 | }, 108 | style = TextStyle(color = Color.Black) 109 | ) 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/AnimateDpDemos.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo 2 | 3 | import androidx.compose.animation.animateColorAsState 4 | import androidx.compose.animation.core.animateDpAsState 5 | import androidx.compose.foundation.Image 6 | import androidx.compose.foundation.border 7 | import androidx.compose.foundation.clickable 8 | import androidx.compose.foundation.layout.* 9 | import androidx.compose.foundation.shape.RoundedCornerShape 10 | import androidx.compose.material.* 11 | import androidx.compose.runtime.Composable 12 | import androidx.compose.runtime.getValue 13 | import androidx.compose.runtime.mutableStateOf 14 | import androidx.compose.runtime.remember 15 | import androidx.compose.ui.Alignment 16 | import androidx.compose.ui.Modifier 17 | import androidx.compose.ui.draw.clip 18 | import androidx.compose.ui.graphics.Color 19 | import androidx.compose.ui.layout.ContentScale 20 | import androidx.compose.ui.res.painterResource 21 | import androidx.compose.ui.unit.Dp 22 | import androidx.compose.ui.unit.dp 23 | import androidx.compose.material.ButtonDefaults 24 | import androidx.compose.ui.tooling.preview.Preview 25 | 26 | @Preview 27 | @Composable 28 | fun ColorAnimation() { 29 | val enabled = remember { mutableStateOf(true) } 30 | val color: Color by animateColorAsState( 31 | if (enabled.value) MaterialTheme.colors.primary else MaterialTheme.colors.secondary 32 | ) 33 | Button( 34 | onClick = { enabled.value = !enabled.value }, 35 | colors = ButtonDefaults.buttonColors(backgroundColor = color), 36 | modifier = Modifier.padding(16.dp).fillMaxWidth() 37 | ) { 38 | Text("Color Animation") 39 | } 40 | } 41 | 42 | @Composable 43 | fun ScaleAndColorAnimation() { 44 | val enabled = remember { mutableStateOf(true) } 45 | val color: Color by animateColorAsState( 46 | if (enabled.value) MaterialTheme.colors.primary else MaterialTheme.colors.secondary) 47 | val height: Dp by animateDpAsState(if (enabled.value) 40.dp else 60.dp) 48 | val width: Dp by animateDpAsState(if (enabled.value) 150.dp else 300.dp) 49 | Button( 50 | onClick = { enabled.value = !enabled.value }, 51 | colors = ButtonDefaults.buttonColors(backgroundColor = color), 52 | modifier = Modifier 53 | .padding(16.dp) 54 | .height(height) 55 | .width(width), 56 | ) { 57 | Text("Scale & Color") 58 | } 59 | } 60 | 61 | @Composable 62 | fun GenderSelectAnimation() { 63 | val female = remember { mutableStateOf(true) } 64 | Row(horizontalArrangement = Arrangement.Center, 65 | modifier = Modifier.padding(8.dp).fillMaxWidth(), 66 | verticalAlignment = Alignment.CenterVertically 67 | ) { 68 | Image( 69 | painter = painterResource(R.drawable.male), 70 | contentDescription = "Male Image", 71 | contentScale = ContentScale.Crop, 72 | modifier = Modifier 73 | .size(animateDpAsState(if (female.value) 100.dp else 250.dp).value) 74 | .border(width = animateDpAsState(if (female.value) 0.dp else 4.dp).value, 75 | color = animateColorAsState(if (female.value) Color.Transparent else Color.Red).value 76 | ) 77 | .padding(8.dp) 78 | .clickable { female.value = !female.value } 79 | .clip(RoundedCornerShape(animateDpAsState(if (female.value) 0.dp else 8.dp).value)) 80 | ) 81 | Image( 82 | painter = painterResource(R.drawable.female), 83 | contentDescription = "Female Image", 84 | contentScale = ContentScale.Crop, 85 | modifier = Modifier 86 | .size(animateDpAsState(if (!female.value) 100.dp else 250.dp).value) 87 | .border(width = animateDpAsState(if (!female.value) 0.dp else 4.dp).value, 88 | color = animateColorAsState(if (!female.value) Color.Transparent else Color.Red).value) 89 | .padding(8.dp) 90 | .clickable { female.value = !female.value } 91 | .clip(RoundedCornerShape(animateDpAsState(if (!female.value) 0.dp else 8.dp).value)) 92 | ) 93 | } 94 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/AnimatedValues.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo 2 | 3 | import androidx.compose.animation.Animatable 4 | import androidx.compose.animation.core.* 5 | import androidx.compose.foundation.* 6 | import androidx.compose.foundation.layout.* 7 | import androidx.compose.material.icons.Icons 8 | import androidx.compose.material.icons.filled.Favorite 9 | import androidx.compose.runtime.Composable 10 | import androidx.compose.runtime.LaunchedEffect 11 | import androidx.compose.runtime.remember 12 | import androidx.compose.ui.Modifier 13 | import androidx.compose.ui.graphics.Color 14 | import androidx.compose.ui.graphics.ColorFilter 15 | import androidx.compose.ui.graphics.drawscope.withTransform 16 | import androidx.compose.ui.unit.dp 17 | 18 | @Composable 19 | fun HeartBeatDemo() { 20 | val animScale = remember { Animatable(initialValue = 1f) } 21 | val animColor = remember { Animatable(initialValue = Color.Red) } 22 | 23 | LaunchedEffect(animScale) { 24 | animScale.animateTo( 25 | targetValue = 2f, 26 | animationSpec = infiniteRepeatable( 27 | animation = tween(durationMillis = 300, easing = FastOutLinearInEasing, delayMillis = 1000), 28 | repeatMode = RepeatMode.Reverse 29 | ) 30 | ) 31 | } 32 | 33 | LaunchedEffect(animColor) { 34 | animColor.animateTo( 35 | targetValue = Color.Blue, 36 | animationSpec = infiniteRepeatable( 37 | animation = tween(durationMillis = 300, easing = LinearEasing, delayMillis = 1000), 38 | repeatMode = RepeatMode.Reverse 39 | ) 40 | ) 41 | } 42 | 43 | Image(imageVector = Icons.Default.Favorite, 44 | contentDescription = "Favourite Icon", 45 | modifier = Modifier.size((40*animScale.value).dp).padding(10.dp), 46 | colorFilter = ColorFilter.tint(animColor.value) 47 | ) 48 | } 49 | 50 | @Composable 51 | fun MovingSquare() { 52 | val animPosX = remember { Animatable(initialValue = 0f) } 53 | 54 | LaunchedEffect(animPosX) { 55 | animPosX.animateTo( 56 | targetValue = 500f, 57 | animationSpec = infiniteRepeatable( 58 | animation = tween(durationMillis = 1000) 59 | ) 60 | ) 61 | } 62 | 63 | Canvas(modifier = Modifier.size(100.dp), onDraw = { 64 | withTransform({ 65 | translate(left = animPosX.value) 66 | }) { 67 | drawRect(color = Color.Red) 68 | } 69 | }) 70 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/AnimatedVisibilityDemos.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo 2 | 3 | import androidx.compose.animation.* 4 | import androidx.compose.animation.core.tween 5 | import androidx.compose.foundation.background 6 | import androidx.compose.foundation.clickable 7 | import androidx.compose.foundation.layout.* 8 | import androidx.compose.foundation.shape.RoundedCornerShape 9 | import androidx.compose.material.Card 10 | import androidx.compose.material.FloatingActionButton 11 | import androidx.compose.material.Icon 12 | import androidx.compose.material.Text 13 | import androidx.compose.material.icons.Icons 14 | import androidx.compose.material.icons.filled.* 15 | import androidx.compose.runtime.* 16 | import androidx.compose.ui.Alignment 17 | import androidx.compose.ui.Modifier 18 | import androidx.compose.ui.graphics.Color 19 | import androidx.compose.ui.graphics.vector.ImageVector 20 | import androidx.compose.ui.text.TextStyle 21 | import androidx.compose.ui.text.font.FontWeight 22 | import androidx.compose.ui.unit.dp 23 | import androidx.compose.ui.unit.sp 24 | import com.wajahatkarim3.animations.demo.ui.* 25 | import java.util.* 26 | 27 | @Composable 28 | fun VisibilityAnimationFAB() { 29 | var expanded by remember { mutableStateOf(true) } 30 | FloatingActionButton( 31 | onClick = { expanded = !expanded }, 32 | modifier = Modifier.padding(10.dp) 33 | ) { 34 | Row(Modifier.padding(start = 16.dp, end = 16.dp)) { 35 | Icon( 36 | imageVector = Icons.Default.Favorite, 37 | contentDescription = "Favorite Icon", 38 | Modifier.align(Alignment.CenterVertically) 39 | ) 40 | AnimatedVisibility( 41 | expanded, 42 | modifier = Modifier.align(Alignment.CenterVertically), 43 | enter = slideInHorizontally( 44 | initialOffsetX = { 300 }, 45 | animationSpec = tween(durationMillis = 2000) 46 | ), 47 | exit = slideOutVertically( 48 | targetOffsetY = { 100 }, 49 | animationSpec = tween(durationMillis = 2000) 50 | ) 51 | ) { 52 | Text(modifier = Modifier.padding(start = 8.dp), text = "Like") 53 | } 54 | } 55 | } 56 | } 57 | 58 | @OptIn(ExperimentalAnimationApi::class) 59 | @Composable 60 | fun AnimatedBottomNavigation() { 61 | 62 | val bottomOptions = ArrayList() 63 | bottomOptions.add(BottomMenuOption(bgColor = homeBgColor, textColor = homeTextColor, text = "Home", icon = Icons.Default.Home)) 64 | bottomOptions.add(BottomMenuOption(bgColor = likeBgColor, textColor = likeTextColor, text = "Like", icon = Icons.Default.FavoriteBorder)) 65 | bottomOptions.add(BottomMenuOption(bgColor = bookmarkBgColor, textColor = bookmarkTextColor, text = "Cart", icon = Icons.Default.ShoppingCart)) 66 | bottomOptions.add(BottomMenuOption(bgColor = settingsBgColor, textColor = settingsTextColor, text = "Settings", icon = Icons.Default.Settings)) 67 | 68 | val selectedIndex = remember { mutableStateOf(0) } 69 | 70 | Card( 71 | backgroundColor = Color.White, 72 | elevation = 10.dp, 73 | modifier = Modifier.padding(10.dp) 74 | ) { 75 | Row(modifier = Modifier.fillMaxWidth().wrapContentHeight().padding(10.dp), 76 | horizontalArrangement = Arrangement.SpaceAround 77 | ) { 78 | for (i in 0 until bottomOptions.size) { 79 | BottomMenuButton( 80 | selected = i == selectedIndex.value, 81 | bgColor = bottomOptions[i].bgColor, 82 | textColor = bottomOptions[i].textColor, 83 | text = bottomOptions[i].text, 84 | icon = bottomOptions[i].icon 85 | ) { 86 | selectedIndex.value = i 87 | } 88 | } 89 | } 90 | } 91 | } 92 | 93 | @ExperimentalAnimationApi 94 | @Composable 95 | fun BottomMenuButton(modifier: Modifier = Modifier, selected: Boolean, bgColor: Color, textColor: Color, text: String, icon: ImageVector, onClick: () -> Unit) { 96 | Box( 97 | modifier = modifier.wrapContentWidth(align = Alignment.CenterHorizontally) 98 | .background(color = if (selected) bgColor else Color.Transparent, shape = RoundedCornerShape(percent = 50)) 99 | .clickable(onClick = onClick) 100 | .padding(top = 10.dp, bottom = 10.dp, start = 20.dp, end = 20.dp) 101 | ) { 102 | Row { 103 | Icon( 104 | imageVector = icon, 105 | contentDescription = "", 106 | modifier = Modifier.padding(end = 5.dp).size(20.dp), 107 | tint = if (selected) textColor else Color.Black 108 | ) 109 | AnimatedVisibility( 110 | selected, 111 | modifier = Modifier.align(Alignment.CenterVertically), 112 | ) { 113 | Text( 114 | text = text, 115 | style = TextStyle( 116 | color = textColor, 117 | fontWeight = FontWeight.Bold, 118 | fontSize = 15.sp 119 | ) 120 | ) 121 | } 122 | } 123 | } 124 | } 125 | 126 | data class BottomMenuOption ( 127 | val bgColor: Color, 128 | val textColor: Color, 129 | val text: String, 130 | val icon: ImageVector 131 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/CircleMenu.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo 2 | 3 | import android.util.Log 4 | import androidx.compose.animation.ExperimentalAnimationApi 5 | import androidx.compose.animation.core.animateFloatAsState 6 | import androidx.compose.foundation.background 7 | import androidx.compose.foundation.clickable 8 | import androidx.compose.foundation.layout.* 9 | import androidx.compose.foundation.shape.CircleShape 10 | import androidx.compose.material.Icon 11 | import androidx.compose.material.icons.Icons 12 | import androidx.compose.material.icons.filled.* 13 | import androidx.compose.runtime.Composable 14 | import androidx.compose.runtime.mutableStateOf 15 | import androidx.compose.runtime.remember 16 | import androidx.compose.ui.Alignment 17 | import androidx.compose.ui.Modifier 18 | import androidx.compose.ui.draw.alpha 19 | import androidx.compose.ui.graphics.Color 20 | import androidx.compose.ui.graphics.graphicsLayer 21 | import androidx.compose.ui.graphics.vector.ImageVector 22 | import androidx.compose.ui.unit.dp 23 | import java.util.* 24 | import kotlin.math.cos 25 | import kotlin.math.sin 26 | 27 | @ExperimentalAnimationApi 28 | @Composable 29 | fun CircleMenu() { 30 | val menuOpen = remember { mutableStateOf(false) } 31 | val distance = 150f 32 | val startDegrees = -90.0 33 | 34 | val menuOptions = ArrayList() 35 | menuOptions.add(MenuOptionModel(icon = Icons.Default.Home, backgroundColor = Color(0xFF35ACE9))) 36 | menuOptions.add(MenuOptionModel(icon = Icons.Default.Search, backgroundColor = Color(0xFF648C00))) 37 | menuOptions.add(MenuOptionModel(icon = Icons.Default.Notifications, backgroundColor = Color(0xFFFF5242))) 38 | menuOptions.add(MenuOptionModel(icon = Icons.Default.Settings, backgroundColor = Color(0xFFAD71D2))) 39 | menuOptions.add(MenuOptionModel(icon = Icons.Default.LocationOn, backgroundColor = Color(0xFFFFBD2E))) 40 | 41 | val degreeDiff = 360 / menuOptions.size 42 | 43 | Box(modifier = Modifier.fillMaxWidth().height(500.dp), 44 | contentAlignment = Alignment.Center 45 | ) { 46 | // Surrounding Menu Options 47 | var degrees = startDegrees 48 | for (i in 0 until menuOptions.size) { 49 | val menu = menuOptions[i] 50 | MenuIcon( 51 | icon = menu.icon, 52 | backgroundColor = menu.backgroundColor, 53 | degrees = degrees, 54 | distance = distance, 55 | isMenuOpen = menuOpen.value, 56 | onClick = { 57 | menuOpen.value = !menuOpen.value 58 | Log.e("Circle", "Button Out Clicked") 59 | } 60 | ) 61 | degrees += degreeDiff 62 | } 63 | 64 | // Menu Center Icon 65 | Icon( 66 | imageVector = if (menuOpen.value) Icons.Default.Close else Icons.Default.Menu, 67 | contentDescription = "", 68 | modifier = Modifier.clickable(onClick = { 69 | menuOpen.value = !menuOpen.value 70 | Log.e("Circle", "Center Clicked") 71 | }).background( 72 | color = if (menuOpen.value) Color.Gray else Color.White, 73 | shape = CircleShape) 74 | .padding(10.dp), 75 | tint = Color.Black 76 | ) 77 | } 78 | } 79 | 80 | @Composable 81 | fun MenuIcon(icon: ImageVector, backgroundColor: Color, degrees: Double, distance: Float, isMenuOpen: Boolean, onClick: () -> Unit) { 82 | // 0 83 | Box { 84 | Icon( 85 | imageVector = icon, 86 | contentDescription = "", 87 | modifier = Modifier 88 | .graphicsLayer( 89 | translationX = animateFloatAsState( 90 | if (isMenuOpen) distance * cos(Math.toRadians(degrees)) 91 | .toFloat() else 0f 92 | ).value, 93 | translationY = animateFloatAsState( 94 | if (isMenuOpen) distance * sin(Math.toRadians(degrees)) 95 | .toFloat() else 0f 96 | ).value 97 | ).clickable(onClick = { 98 | onClick.invoke() 99 | Log.e("Circle", "Button Clicked") 100 | }) 101 | .alpha(animateFloatAsState(targetValue = if (isMenuOpen) 1f else 0f).value) 102 | .background(color = backgroundColor, shape = CircleShape).padding(10.dp), 103 | tint = Color.White 104 | ) 105 | } 106 | } 107 | 108 | data class MenuOptionModel ( 109 | val icon: ImageVector, 110 | val backgroundColor: Color 111 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/FlipView.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo 2 | 3 | import androidx.compose.animation.core.* 4 | import androidx.compose.foundation.clickable 5 | import androidx.compose.foundation.interaction.MutableInteractionSource 6 | import androidx.compose.foundation.layout.Box 7 | import androidx.compose.foundation.layout.fillMaxSize 8 | import androidx.compose.runtime.Composable 9 | import androidx.compose.runtime.mutableStateOf 10 | import androidx.compose.runtime.remember 11 | import androidx.compose.runtime.getValue 12 | import androidx.compose.runtime.setValue 13 | import androidx.compose.ui.Alignment 14 | import androidx.compose.ui.Modifier 15 | import androidx.compose.ui.draw.alpha 16 | import androidx.compose.ui.graphics.graphicsLayer 17 | 18 | enum class FlipViewState { 19 | FRONT, BACK 20 | } 21 | 22 | @Composable 23 | fun FlipView(front: @Composable () -> Unit, back: @Composable () -> Unit, flipDurationMs: Int = 1000) { 24 | 25 | var flipViewState by remember { mutableStateOf(FlipViewState.FRONT) } 26 | val transition: Transition = updateTransition(flipViewState, label = "FlipViewState animation") 27 | 28 | val frontRotation: Float by transition.animateFloat( 29 | label = "Front Rotation", 30 | transitionSpec = { 31 | when { 32 | FlipViewState.FRONT isTransitioningTo FlipViewState.BACK -> { 33 | keyframes { 34 | durationMillis = flipDurationMs 35 | 0f at 0 36 | 90f at flipDurationMs / 2 37 | 90f at flipDurationMs 38 | } 39 | } 40 | 41 | FlipViewState.BACK isTransitioningTo FlipViewState.FRONT -> { 42 | keyframes { 43 | durationMillis = flipDurationMs 44 | 90f at 0 45 | 90f at flipDurationMs / 2 46 | 0f at flipDurationMs 47 | } 48 | } 49 | 50 | else -> snap() 51 | } 52 | } 53 | ) { state -> 54 | when(state) { 55 | FlipViewState.FRONT -> 0f 56 | FlipViewState.BACK -> 180f 57 | } 58 | } 59 | 60 | val backRotation: Float by transition.animateFloat( 61 | label = "Back Rotation", 62 | transitionSpec = { 63 | when { 64 | FlipViewState.FRONT isTransitioningTo FlipViewState.BACK -> { 65 | keyframes { 66 | durationMillis = flipDurationMs 67 | -90f at 0 68 | -90f at flipDurationMs / 2 69 | 0f at flipDurationMs 70 | } 71 | } 72 | 73 | FlipViewState.BACK isTransitioningTo FlipViewState.FRONT -> { 74 | keyframes { 75 | durationMillis = flipDurationMs 76 | 0f at 0 77 | -90f at flipDurationMs / 2 78 | -90f at flipDurationMs 79 | } 80 | } 81 | 82 | else -> snap() 83 | } 84 | } 85 | ) { state -> 86 | when(state) { 87 | FlipViewState.FRONT -> 180f 88 | FlipViewState.BACK -> 0f 89 | } 90 | } 91 | 92 | val frontOpacity: Float by transition.animateFloat( 93 | label = "Front Opacity", 94 | transitionSpec = { 95 | when { 96 | FlipViewState.FRONT isTransitioningTo FlipViewState.BACK -> { 97 | keyframes { 98 | durationMillis = flipDurationMs 99 | 1f at 0 100 | 1f at (flipDurationMs / 2) - 1 101 | 0f at flipDurationMs / 2 102 | 0f at flipDurationMs 103 | } 104 | } 105 | 106 | FlipViewState.BACK isTransitioningTo FlipViewState.FRONT -> { 107 | keyframes { 108 | durationMillis = flipDurationMs 109 | 0f at 0 110 | 0f at (flipDurationMs / 2) - 1 111 | 1f at flipDurationMs / 2 112 | 1f at flipDurationMs 113 | } 114 | } 115 | 116 | else -> snap() 117 | } 118 | } 119 | ) { state -> 120 | when(state) { 121 | FlipViewState.FRONT -> 1f 122 | FlipViewState.BACK -> 0f 123 | } 124 | } 125 | 126 | val backOpacity: Float by transition.animateFloat( 127 | label = "Back Opacity", 128 | transitionSpec = { 129 | when { 130 | FlipViewState.FRONT isTransitioningTo FlipViewState.BACK -> { 131 | keyframes { 132 | durationMillis = flipDurationMs 133 | 0f at 0 134 | 0f at (flipDurationMs / 2) - 1 135 | 1f at flipDurationMs / 2 136 | 1f at flipDurationMs 137 | } 138 | } 139 | 140 | FlipViewState.BACK isTransitioningTo FlipViewState.FRONT -> { 141 | keyframes { 142 | durationMillis = flipDurationMs 143 | 1f at 0 144 | 1f at (flipDurationMs / 2) - 1 145 | 0f at flipDurationMs / 2 146 | 0f at flipDurationMs 147 | } 148 | } 149 | 150 | else -> snap() 151 | } 152 | } 153 | ) { state -> 154 | when(state) { 155 | FlipViewState.FRONT -> 0f 156 | FlipViewState.BACK -> 1f 157 | } 158 | } 159 | 160 | Box( 161 | modifier = Modifier.fillMaxSize().clickable(onClick = { 162 | flipViewState = if (flipViewState == FlipViewState.FRONT) FlipViewState.BACK else FlipViewState.FRONT 163 | }, interactionSource = remember { MutableInteractionSource() }, indication = null), 164 | contentAlignment = Alignment.Center, 165 | ) { 166 | Box(modifier = Modifier.graphicsLayer( 167 | rotationY = backRotation 168 | ).alpha(backOpacity)) { 169 | back() 170 | } 171 | Box(modifier = Modifier.graphicsLayer( 172 | rotationY = frontRotation 173 | ).alpha(frontOpacity)) { 174 | front() 175 | } 176 | } 177 | 178 | // val flipViewState = remember { mutableStateOf(FlipViewState.FRONT) } 179 | // 180 | // val rotationTranDef = transitionDefinition { 181 | // state(FlipViewState.FRONT) { 182 | // this[frontRotationKey] = 0f 183 | // this[backRotationKey] = 180f 184 | // this[frontOpacityKey] = 1f 185 | // this[backOpacityKey] = 0f 186 | // } 187 | // 188 | // state(FlipViewState.BACK) { 189 | // this[frontRotationKey] = 180f 190 | // this[backRotationKey] = 0f 191 | // this[frontOpacityKey] = 0f 192 | // this[backOpacityKey] = 1f 193 | // } 194 | // 195 | // transition(fromState = FlipViewState.FRONT, toState = FlipViewState.BACK) { 196 | // frontRotationKey using keyframes { 197 | // durationMillis = flipDurationMs 198 | // 0f at 0 199 | // 90f at flipDurationMs / 2 200 | // 90f at flipDurationMs 201 | // } 202 | // frontOpacityKey using keyframes { 203 | // durationMillis = flipDurationMs 204 | // 1f at 0 205 | // 1f at (flipDurationMs / 2) - 1 206 | // 0f at flipDurationMs / 2 207 | // 0f at flipDurationMs 208 | // } 209 | // 210 | // backRotationKey using keyframes { 211 | // durationMillis = flipDurationMs 212 | // -90f at 0 213 | // -90f at flipDurationMs / 2 214 | // 0f at flipDurationMs 215 | // } 216 | // backOpacityKey using keyframes { 217 | // durationMillis = flipDurationMs 218 | // 0f at 0 219 | // 0f at (flipDurationMs / 2) - 1 220 | // 1f at flipDurationMs / 2 221 | // 1f at flipDurationMs 222 | // } 223 | // } 224 | // 225 | // transition(FlipViewState.BACK to FlipViewState.FRONT) { 226 | // frontRotationKey using keyframes { 227 | // durationMillis = flipDurationMs 228 | // 90f at 0 229 | // 90f at flipDurationMs / 2 230 | // 0f at flipDurationMs 231 | // } 232 | // frontOpacityKey using keyframes { 233 | // durationMillis = flipDurationMs 234 | // 0f at 0 235 | // 0f at (flipDurationMs / 2) - 1 236 | // 1f at flipDurationMs / 2 237 | // 1f at flipDurationMs 238 | // } 239 | // 240 | // backRotationKey using keyframes { 241 | // durationMillis = flipDurationMs 242 | // 0f at 0 243 | // -90f at flipDurationMs / 2 244 | // -90f at flipDurationMs 245 | // } 246 | // backOpacityKey using keyframes { 247 | // durationMillis = flipDurationMs 248 | // 1f at 0 249 | // 1f at (flipDurationMs / 2) - 1 250 | // 0f at flipDurationMs / 2 251 | // 0f at flipDurationMs 252 | // } 253 | // } 254 | // } 255 | // 256 | // val toState = if (flipViewState.value == FlipViewState.FRONT) FlipViewState.BACK else FlipViewState.FRONT 257 | // 258 | // val flipTransitionState = transition( 259 | // definition = rotationTranDef, 260 | // initState = flipViewState.value, 261 | // toState = toState 262 | // ) 263 | // 264 | // Box( 265 | // modifier = Modifier.fillMaxSize().clickable(onClick = { 266 | // flipViewState.value = if (flipViewState.value == FlipViewState.FRONT) FlipViewState.BACK else FlipViewState.FRONT 267 | // }), 268 | // contentAlignment = Alignment.Center, 269 | // ) { 270 | // Box(modifier = Modifier.graphicsLayer( 271 | // rotationY = flipTransitionState[backRotationKey] 272 | // ).alpha(flipTransitionState[backOpacityKey])) { 273 | // back() 274 | // } 275 | // Box(modifier = Modifier.graphicsLayer( 276 | // rotationY = flipTransitionState[frontRotationKey] 277 | // ).alpha(flipTransitionState[frontOpacityKey])) { 278 | // front() 279 | // } 280 | // } 281 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo 2 | 3 | import android.os.Bundle 4 | import androidx.activity.ComponentActivity 5 | import androidx.compose.animation.ExperimentalAnimationApi 6 | import androidx.compose.foundation.Image 7 | import androidx.compose.foundation.layout.Spacer 8 | import androidx.compose.foundation.layout.height 9 | import androidx.compose.foundation.layout.padding 10 | import androidx.compose.foundation.layout.size 11 | import androidx.compose.material.Scaffold 12 | import androidx.compose.material.Text 13 | import androidx.compose.material.TopAppBar 14 | import androidx.compose.runtime.Composable 15 | import androidx.compose.ui.Modifier 16 | import androidx.compose.ui.graphics.Color 17 | import androidx.activity.compose.setContent 18 | import androidx.compose.ui.res.painterResource 19 | import androidx.compose.ui.res.stringResource 20 | import androidx.compose.ui.text.TextStyle 21 | import androidx.compose.ui.unit.dp 22 | import androidx.compose.ui.unit.sp 23 | import androidx.compose.foundation.lazy.LazyColumn 24 | import androidx.compose.material.FabPosition 25 | import com.wajahatkarim3.animations.demo.ui.ComposeAnimDemoTheme 26 | 27 | class MainActivity : ComponentActivity() { 28 | @OptIn(ExperimentalAnimationApi::class) 29 | override fun onCreate(savedInstanceState: Bundle?) { 30 | super.onCreate(savedInstanceState) 31 | setContent { 32 | ComposeAnimDemoTheme { 33 | Scaffold( 34 | topBar = { 35 | TopAppBar( 36 | title = { Text(text = stringResource(id = R.string.title_activity_droidcon)) }, 37 | elevation = 8.dp 38 | ) 39 | }, 40 | floatingActionButton = { 41 | ExplodingFabButton() 42 | }, 43 | floatingActionButtonPosition = FabPosition.End, 44 | content = { contentPadding -> 45 | LazyColumn(modifier = Modifier.padding(contentPadding)) { 46 | item { 47 | Spacer(modifier = Modifier.height(20.dp)) 48 | HeadingText(text = "Circle Menu") 49 | CircleMenu() 50 | Spacer(modifier = Modifier.height(100.dp)) 51 | 52 | HeadingText(text = "animateContentSize()") 53 | AnimateContentSizeDemo() 54 | 55 | HeadingText(text = "AnimatedVisibility()") 56 | VisibilityAnimationFAB() 57 | AnimatedBottomNavigation() 58 | 59 | HeadingText(text = "animate()") 60 | ColorAnimation() 61 | ScaleAndColorAnimation() 62 | Spacer(modifier = Modifier.height(20.dp)) 63 | GenderSelectAnimation() 64 | 65 | HeadingText(text = "animatedFloat") 66 | HeartBeatDemo() 67 | Spacer(modifier = Modifier.height(40.dp)) 68 | MovingSquare() 69 | Spacer(modifier = Modifier.height(100.dp)) 70 | 71 | HeadingText(text = "Transitions") 72 | RayWenderlichFavButton() 73 | FlipView(flipDurationMs = 1000, 74 | front = { 75 | Image( 76 | painter = painterResource(id = R.drawable.card_front), 77 | contentDescription = "", 78 | modifier = Modifier.size(width = 300.dp, height = 150.dp) 79 | ) 80 | }, 81 | back = { 82 | Image( 83 | painter = painterResource(id = R.drawable.card_back), 84 | contentDescription = "", 85 | modifier = Modifier.size(width = 300.dp, height = 150.dp) 86 | ) 87 | }) 88 | } 89 | } 90 | } 91 | ) 92 | } 93 | } 94 | } 95 | } 96 | 97 | @Composable 98 | fun HeadingText(text: String) { 99 | Text( 100 | text = text, 101 | style = TextStyle( 102 | color = Color.Black, 103 | fontSize = 15.sp 104 | ), 105 | modifier = Modifier.padding(10.dp) 106 | ) 107 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/RWButton.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo 2 | 3 | import androidx.compose.animation.core.* 4 | import androidx.compose.foundation.BorderStroke 5 | import androidx.compose.foundation.layout.* 6 | import androidx.compose.foundation.shape.CornerSize 7 | import androidx.compose.foundation.shape.RoundedCornerShape 8 | import androidx.compose.material.icons.Icons 9 | import androidx.compose.material.icons.filled.Favorite 10 | import androidx.compose.material.icons.filled.FavoriteBorder 11 | import androidx.compose.animation.animateColor 12 | import androidx.compose.material.* 13 | import androidx.compose.runtime.Composable 14 | import androidx.compose.runtime.mutableStateOf 15 | import androidx.compose.runtime.remember 16 | import androidx.compose.runtime.getValue 17 | import androidx.compose.runtime.setValue 18 | import androidx.compose.ui.unit.Dp 19 | import androidx.compose.ui.Modifier 20 | import androidx.compose.ui.draw.alpha 21 | import androidx.compose.ui.graphics.Color 22 | import androidx.compose.ui.text.TextStyle 23 | import androidx.compose.ui.tooling.preview.Preview 24 | import androidx.compose.ui.unit.dp 25 | 26 | enum class RWButtonState { 27 | IDLE, PRESSED 28 | } 29 | 30 | @Preview 31 | @Composable 32 | fun RayWenderlichFavButton() { 33 | var toState by remember { mutableStateOf(RWButtonState.IDLE) } 34 | val primaryColor = MaterialTheme.colors.primary 35 | 36 | val transition: Transition = updateTransition(targetState = toState) 37 | 38 | val width: Dp by transition.animateDp( 39 | label = "Width", 40 | transitionSpec = { 41 | when { 42 | RWButtonState.IDLE isTransitioningTo RWButtonState.PRESSED -> { 43 | tween(durationMillis = 1000, easing = FastOutSlowInEasing) 44 | } 45 | RWButtonState.PRESSED isTransitioningTo RWButtonState.IDLE -> { 46 | tween(durationMillis = 1000, easing = FastOutSlowInEasing) 47 | } 48 | else -> tween(durationMillis = 1000, easing = FastOutSlowInEasing) 49 | } 50 | } 51 | ) { state -> 52 | when(state) { 53 | RWButtonState.IDLE -> 200.dp 54 | RWButtonState.PRESSED -> 60.dp 55 | } 56 | } 57 | 58 | val roundedCorner: Int by transition.animateInt( 59 | label = "Corner Radius", 60 | transitionSpec = { 61 | when { 62 | RWButtonState.IDLE isTransitioningTo RWButtonState.PRESSED -> { 63 | tween(durationMillis = 400) 64 | } 65 | RWButtonState.PRESSED isTransitioningTo RWButtonState.IDLE -> { 66 | tween(durationMillis = 400) 67 | } 68 | else -> tween(durationMillis = 400) 69 | } 70 | } 71 | ) { state -> 72 | when(state) { 73 | RWButtonState.IDLE -> 6 74 | RWButtonState.PRESSED -> 50 75 | } 76 | } 77 | 78 | val backgroundColor: Color by transition.animateColor( 79 | label = "Background Color", 80 | transitionSpec = { 81 | when { 82 | RWButtonState.IDLE isTransitioningTo RWButtonState.PRESSED -> { 83 | tween(durationMillis = 1000) 84 | } 85 | RWButtonState.PRESSED isTransitioningTo RWButtonState.IDLE -> { 86 | tween(durationMillis = 1000) 87 | } 88 | else -> tween(durationMillis = 1000) 89 | } 90 | } 91 | ) { state -> 92 | when(state) { 93 | RWButtonState.IDLE -> Color.White 94 | RWButtonState.PRESSED -> primaryColor 95 | } 96 | } 97 | 98 | val textColor: Color by transition.animateColor( 99 | label = "Text Color", 100 | transitionSpec = { 101 | when { 102 | RWButtonState.IDLE isTransitioningTo RWButtonState.PRESSED -> { 103 | tween(durationMillis = 500) 104 | } 105 | RWButtonState.PRESSED isTransitioningTo RWButtonState.IDLE -> { 106 | tween(durationMillis = 500) 107 | } 108 | else -> tween(durationMillis = 500) 109 | } 110 | } 111 | ) { state -> 112 | when(state) { 113 | RWButtonState.IDLE -> primaryColor 114 | RWButtonState.PRESSED -> Color.White 115 | } 116 | } 117 | 118 | val textOpacity: Float by transition.animateFloat( 119 | label = "Text Alpha", 120 | transitionSpec = { 121 | when { 122 | RWButtonState.IDLE isTransitioningTo RWButtonState.PRESSED -> { 123 | tween(durationMillis = 1000) 124 | } 125 | RWButtonState.PRESSED isTransitioningTo RWButtonState.IDLE -> { 126 | tween(durationMillis = 1000) 127 | } 128 | else -> tween(durationMillis = 1000) 129 | } 130 | } 131 | ) { state -> 132 | when(state) { 133 | RWButtonState.IDLE -> 1f 134 | RWButtonState.PRESSED -> 0f 135 | } 136 | } 137 | 138 | Button( 139 | onClick = { 140 | toState = if (toState == RWButtonState.PRESSED) RWButtonState.IDLE else RWButtonState.PRESSED 141 | }, 142 | border = BorderStroke(1.dp, color = MaterialTheme.colors.primary), 143 | colors = ButtonDefaults.buttonColors(backgroundColor = backgroundColor, contentColor = textColor), 144 | shape = RoundedCornerShape(corner = CornerSize(percent = roundedCorner)), 145 | modifier = Modifier.size(width = width, height = 60.dp) 146 | ) { 147 | Icon( 148 | imageVector = if (toState == RWButtonState.IDLE) Icons.Default.FavoriteBorder else Icons.Default.Favorite, 149 | contentDescription = "Favorite", 150 | tint = textColor 151 | ) 152 | Spacer(modifier = Modifier.padding(start = 5.dp)) 153 | Text( 154 | text = "Add to Favourite", 155 | style = TextStyle( 156 | color = primaryColor 157 | ), 158 | modifier = Modifier.alpha(textOpacity), 159 | softWrap = false 160 | ) 161 | } 162 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/TransitionsDemo.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo 2 | 3 | import androidx.compose.animation.animateColor 4 | import androidx.compose.animation.core.* 5 | import androidx.compose.foundation.layout.offset 6 | import androidx.compose.foundation.layout.size 7 | import androidx.compose.foundation.shape.RoundedCornerShape 8 | import androidx.compose.material.FloatingActionButton 9 | import androidx.compose.material.Icon 10 | import androidx.compose.material.MaterialTheme 11 | import androidx.compose.material.icons.Icons 12 | import androidx.compose.material.icons.filled.Add 13 | import androidx.compose.runtime.* 14 | import androidx.compose.ui.Modifier 15 | import androidx.compose.ui.draw.alpha 16 | import androidx.compose.ui.graphics.Color 17 | import androidx.compose.ui.tooling.preview.Preview 18 | import androidx.compose.ui.unit.Dp 19 | import androidx.compose.ui.unit.dp 20 | 21 | enum class FabSizeState { 22 | NORMAL, EXPLODED 23 | } 24 | 25 | @Preview 26 | @Composable 27 | fun ExplodingFabButton() { 28 | var fabSizeState by remember { mutableStateOf(FabSizeState.NORMAL) } 29 | val secondaryColor = MaterialTheme.colors.secondary 30 | val primaryColor = MaterialTheme.colors.primary 31 | 32 | 33 | val fabTransition: Transition = updateTransition(fabSizeState, label = "Fab Size Transition") 34 | 35 | val fabSize: Float by fabTransition.animateFloat( 36 | label = "Fab Size", 37 | transitionSpec = { 38 | when { 39 | FabSizeState.NORMAL isTransitioningTo FabSizeState.EXPLODED -> { 40 | keyframes { 41 | durationMillis = 1000 42 | 80f at 0 43 | 35f at 200 44 | 5000f at 1000 45 | } 46 | } 47 | FabSizeState.EXPLODED isTransitioningTo FabSizeState.NORMAL -> { 48 | tween(durationMillis = 1000, easing = FastOutSlowInEasing) 49 | } 50 | else -> snap() 51 | } 52 | } 53 | ) { state -> 54 | when (state) { 55 | FabSizeState.NORMAL -> 80f 56 | FabSizeState.EXPLODED -> 5000f 57 | } 58 | } 59 | 60 | val fabColor: Color by fabTransition.animateColor( 61 | label = "Fab Color", 62 | transitionSpec = { 63 | when { 64 | FabSizeState.NORMAL isTransitioningTo FabSizeState.EXPLODED -> { 65 | tween(durationMillis = 1000, easing = FastOutSlowInEasing) 66 | } 67 | FabSizeState.EXPLODED isTransitioningTo FabSizeState.NORMAL -> { 68 | tween(durationMillis = 1000, easing = FastOutSlowInEasing) 69 | } 70 | else -> snap() 71 | } 72 | } 73 | ) { state -> 74 | when (state) { 75 | FabSizeState.NORMAL -> secondaryColor 76 | FabSizeState.EXPLODED -> primaryColor 77 | } 78 | } 79 | 80 | val fabIconAlpha: Float by fabTransition.animateFloat(label = "Fab Icon Alpha") { state -> 81 | when (state) { 82 | FabSizeState.NORMAL -> 1f 83 | FabSizeState.EXPLODED -> 0f 84 | } 85 | } 86 | 87 | val fabRadius: Int by fabTransition.animateInt( 88 | label = "Fab Radius", 89 | transitionSpec = { 90 | when { 91 | FabSizeState.NORMAL isTransitioningTo FabSizeState.EXPLODED -> { 92 | keyframes { 93 | durationMillis = 1000 94 | 50 at 0 95 | 0 at 500 96 | 0 at 1000 97 | } 98 | } 99 | 100 | FabSizeState.EXPLODED isTransitioningTo FabSizeState.NORMAL -> { 101 | keyframes { 102 | durationMillis = 1000 103 | 0 at 0 104 | 0 at 500 105 | 50 at 1000 106 | } 107 | } 108 | 109 | else -> snap() 110 | } 111 | } 112 | ) { state -> 113 | when (state) { 114 | FabSizeState.NORMAL -> 50 115 | FabSizeState.EXPLODED -> 0 116 | } 117 | } 118 | 119 | val fabOffset: Dp by fabTransition.animateDp(label = "Fab Offset") { state -> 120 | when(state) { 121 | FabSizeState.NORMAL -> 0.dp 122 | FabSizeState.EXPLODED -> 16.dp 123 | } 124 | } 125 | 126 | FloatingActionButton( 127 | onClick = { 128 | fabSizeState = if (fabSizeState == FabSizeState.NORMAL) 129 | FabSizeState.EXPLODED 130 | else FabSizeState.NORMAL 131 | }, 132 | modifier = Modifier 133 | .size(fabSize.dp) 134 | .offset(x = fabOffset, y = fabOffset), 135 | backgroundColor = fabColor, 136 | shape = RoundedCornerShape(percent = fabRadius) 137 | ) { 138 | Icon( 139 | imageVector = Icons.Default.Add, 140 | contentDescription = "Add", 141 | modifier = Modifier.alpha(fabIconAlpha) 142 | ) 143 | } 144 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/ui/Color.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo.ui 2 | 3 | import androidx.compose.ui.graphics.Color 4 | 5 | val purple200 = Color(0xFFBB86FC) 6 | val purple500 = Color(0xFF6200EE) 7 | val purple700 = Color(0xFF3700B3) 8 | val teal200 = Color(0xFF03DAC5) 9 | val backgroundLight = Color(0xFFEEEEEE) 10 | val backgroundDark = Color(0xFF252525) 11 | 12 | val bookmarkBgColor = Color(0xFFDBECFB) 13 | val bookmarkTextColor = Color(0xFF55A2EF) 14 | val homeBgColor = Color(0xFFE6E4E6) 15 | val homeTextColor = Color(0xFF878587) 16 | val likeBgColor = Color(0xFFFCE1EC) 17 | val likeTextColor = Color(0xFFF47CA7) 18 | val settingsBgColor = Color(0xFFEFE8E7) 19 | val settingsTextColor = Color(0xFFB99991) -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/ui/Shape.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo.ui 2 | 3 | import androidx.compose.foundation.shape.RoundedCornerShape 4 | import androidx.compose.material.Shapes 5 | import androidx.compose.ui.unit.dp 6 | 7 | val shapes = Shapes( 8 | small = RoundedCornerShape(4.dp), 9 | medium = RoundedCornerShape(4.dp), 10 | large = RoundedCornerShape(0.dp) 11 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/ui/Theme.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo.ui 2 | 3 | import androidx.compose.foundation.isSystemInDarkTheme 4 | import androidx.compose.material.MaterialTheme 5 | import androidx.compose.material.darkColors 6 | import androidx.compose.material.lightColors 7 | import androidx.compose.runtime.Composable 8 | 9 | private val DarkColorPalette = darkColors( 10 | primary = purple200, 11 | primaryVariant = purple700, 12 | secondary = teal200, 13 | background = backgroundDark 14 | ) 15 | 16 | private val LightColorPalette = lightColors( 17 | primary = purple500, 18 | primaryVariant = purple700, 19 | secondary = teal200, 20 | background = backgroundLight 21 | 22 | /* Other default colors to override 23 | background = Color.White, 24 | surface = Color.White, 25 | onPrimary = Color.White, 26 | onSecondary = Color.Black, 27 | onBackground = Color.Black, 28 | onSurface = Color.Black, 29 | */ 30 | ) 31 | 32 | @Composable 33 | fun ComposeAnimDemoTheme( 34 | darkTheme: Boolean = isSystemInDarkTheme(), 35 | content: @Composable() () -> Unit 36 | ) { 37 | val colors = if (darkTheme) { 38 | DarkColorPalette 39 | } else { 40 | LightColorPalette 41 | } 42 | 43 | MaterialTheme( 44 | colors = colors, 45 | typography = typography, 46 | shapes = shapes, 47 | content = content 48 | ) 49 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wajahatkarim3/animations/demo/ui/Type.kt: -------------------------------------------------------------------------------- 1 | package com.wajahatkarim3.animations.demo.ui 2 | 3 | import androidx.compose.material.Typography 4 | import androidx.compose.ui.text.TextStyle 5 | import androidx.compose.ui.text.font.FontFamily 6 | import androidx.compose.ui.text.font.FontWeight 7 | import androidx.compose.ui.unit.sp 8 | 9 | // Set of Material typography styles to start with 10 | val typography = Typography( 11 | body1 = TextStyle( 12 | fontFamily = FontFamily.Default, 13 | fontWeight = FontWeight.Normal, 14 | fontSize = 16.sp 15 | ) 16 | /* Other default text styles to override 17 | button = TextStyle( 18 | fontFamily = FontFamily.Default, 19 | fontWeight = FontWeight.W500, 20 | fontSize = 14.sp 21 | ), 22 | caption = TextStyle( 23 | fontFamily = FontFamily.Default, 24 | fontWeight = FontWeight.Normal, 25 | fontSize = 12.sp 26 | ) 27 | */ 28 | ) -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/card_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/drawable/card_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/card_front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/drawable/card_front.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/female.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/drawable/female.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/male.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/drawable/male.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajahatkarim3/ComposeAnimationsDemo/9a85de430cd892bec776a1956698cf42e51a1f2a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Compose Animations Demo 3 | Compose Animations Demo 4 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean vel felis iaculis purus dignissim vestibulum nec in purus. Fusce ornare vitae dolor vel elementum. Integer euismod nunc a dui pretium, sit amet aliquam lorem rutrum. Vivamus tempor odio eu iaculis interdum. Maecenas a elementum velit. Nullam semper augue velit, sit amet vestibulum quam laoreet vel. Quisque dictum sapien posuere laoreet rutrum. Nunc id tortor mauris. Integer felis ligula, suscipit at ex in, ornare faucibus augue. Nunc vitae libero quis massa vestibulum tempus. Fusce et ipsum euismod ligula dictum ullamcorper. Aenean eu porttitor lacus. Quisque rhoncus, quam sit amet facilisis accumsan, ex libero condimentum lorem, ut porttitor odio est sed erat. Aliquam sed efficitur nulla. 5 | Mauris a est nec nisl tincidunt blandit vitae eu purus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec vel varius tortor, ac condimentum elit. Aenean tristique id odio vitae tincidunt. Suspendisse mauris tellus, elementum quis lorem ut, fermentum tempor mauris. In euismod mi sed interdum congue. Donec neque risus, dignissim vitae vestibulum sit amet, dignissim vitae eros. Maecenas eget auctor massa. Phasellus justo dui, vestibulum nec lacus vel, scelerisque vestibulum leo. Morbi ullamcorper mauris sed purus laoreet, quis dictum arcu venenatis. Phasellus convallis interdum dui, at viverra tortor molestie sed. Cras egestas turpis a orci tincidunt fermentum. Etiam vitae pharetra urna. Nulla a dictum nulla. 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | 21 | 22 |