{"id":26784851,"url":"https://github.com/sagar-viradiya/koreography","last_synced_at":"2025-06-17T06:35:36.135Z","repository":{"id":62304059,"uuid":"536298275","full_name":"sagar-viradiya/koreography","owner":"sagar-viradiya","description":"A light weight Compose Animation library to choreograph low level Animation API through Kotlin DSL.","archived":false,"fork":false,"pushed_at":"2023-06-18T21:00:22.000Z","size":191,"stargazers_count":219,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-19T19:24:08.051Z","etag":null,"topics":["android","animation","coroutines","jetpack-compose","kotlin","kotlindsl","opensource"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sagar-viradiya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-13T20:28:02.000Z","updated_at":"2025-04-19T12:33:06.000Z","dependencies_parsed_at":"2025-03-29T10:32:45.726Z","dependency_job_id":"043d607b-848a-4a9b-82e3-93b9dd60fbe7","html_url":"https://github.com/sagar-viradiya/koreography","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sagar-viradiya/koreography","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagar-viradiya%2Fkoreography","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagar-viradiya%2Fkoreography/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagar-viradiya%2Fkoreography/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagar-viradiya%2Fkoreography/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sagar-viradiya","download_url":"https://codeload.github.com/sagar-viradiya/koreography/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagar-viradiya%2Fkoreography/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260308107,"owners_count":22989804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","animation","coroutines","jetpack-compose","kotlin","kotlindsl","opensource"],"created_at":"2025-03-29T10:32:42.141Z","updated_at":"2025-06-17T06:35:36.072Z","avatar_url":"https://github.com/sagar-viradiya.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Koreography\n_Choreograph your Compose Animation 💃🕺_\n\u003cbr\u003e\u003cbr\u003e\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.sagar-viradiya/koreography)](https://search.maven.org/artifact/io.github.sagar-viradiya/koreography)\n\n[![Github Followers](https://img.shields.io/github/followers/sagar-viradiya?label=Follow\u0026style=social)](https://github.com/sagar-viradiya)\n[![Twitter Follow](https://img.shields.io/twitter/follow/viradiya_sagar?label=Follow\u0026style=social)](https://twitter.com/viradiya_sagar)\n\n\u003cbr\u003e\nA lightweight Compose Animation utility library to choreograph low-level Animation API (https://developer.android.com/jetpack/compose/animation#animation) through Kotlin DSL. It does the heavy lifting of dealing with coroutines under the hood so that you can focus on your animation choreography.\n\n## Including in your project\nKoreography is available on `mavenCentral()`\n\n```groovy\nimplementation 'io.github.sagar-viradiya:koreography:0.3.0'\n```\n\n## Usage\n\nCreating choreography is the process of recording moves on [Animatable](https://developer.android.com/jetpack/compose/animation/value-based#animatable), A low level compose animation API. Moves could be either parallel or sequential. A choreography is a composition of such moves that you can declare through clean and concise Kotlin DSL as shown below. \n\nFor example, let's say you want to sequentially animate alpha first and then scale of an image then you can declare the following choreography. You would then apply animatable values that you are animating in choreography in the Image composable as shown below.\n\n### Choreographying sequential animation\n\n```kotlin\nval alphaAnimatable = remember {\n    Animatable(0f)\n}\n\nval scaleAnimatable = remember {\n    Animatable(0f)\n}\n\nval koreography = rememberKoreography {\n    move(\n        animatable = alphaAnimatable,\n        targetValue = 1f,\n        animationSpec = tween(500)\n    )\n    \n    move(\n        animatable = scaleAnimatable,\n        targetValue = 2f,\n        animationSpec = tween(500)\n    )\n}\n.\n.\n.\nImage(\n    modifier = Modifier.graphicsLayer {\n        alpha = alphaAnimatable.value\n        scaleX = scaleAnimatable.value\n    }, \n    painter = painterResource(id = R.drawable.image)\n)\n```\n\n### Choreographying parallel animation\n\nLet's say you want to parallelly animate alpha and scale of an image then you can declare the following choreography.\n\n```kotlin\nval alphaAnimatable = remember {\n    Animatable(0f)\n}\n\nval scaleAnimatable = remember {\n    Animatable(0f)\n}\n\nval koreography = rememberKoreography {\n    parallelMoves {\n        move(\n            animatable = alphaAnimatable,\n            targetValue = 1f,\n            animationSpec = tween(500)\n        )\n        \n        move(\n            animatable = scaleAnimatable,\n            targetValue = 2f,\n            animationSpec = tween(500)\n        )\n    }\n}\n.\n.\n.\nImage(\n    modifier = Modifier.graphicsLayer {\n        alpha = alphaAnimatable.value\n        scaleX = scaleAnimatable.value\n    }, \n    painter = painterResource(id = R.drawable.image)\n)\n```\n\n### Complex choreography\nYou can have a nested hierarchy of moves to create complex choreography. The example below has three animations running parallelly and out of them, the last one has two animations within running sequentially.\n\n```kotlin\nval alphaAnimatable = remember {\n    Animatable(0f)\n}\n\nval scaleAnimatable = remember {\n    Animatable(0f)\n}\n\nval rotationAnimatable = remember {\n    Animatable(0f)\n}\n\nval translationXAnimatable = remember {\n    Animatble(0f)\n}\n\nval koreography = rememberKoreography {\n    parallelMoves {\n        move(\n            animatable = alphaAnimatable,\n            targetValue = 1f,\n            animationSpec = tween(500)\n        )\n        \n        move(\n            animatable = scaleAnimatable,\n            targetValue = 2f,\n            animationSpec = tween(500)\n        )\n        \n        sequentialMoves {\n            move(\n                animatable = rotationAnimatable,\n                targetValue = 20f,\n                animationSpec = tween(500)\n            )\n            \n            move(\n                animatable = translationXAnimatable,\n                targetValue = 200f,\n                animationSpec = tween(500)\n            )\n        }\n    }\n}\n.\n.\n.\nImage(\n    modifier = Modifier.graphicsLayer {\n        alpha = alphaAnimatable.value\n        scaleX = scaleAnimatable.value\n        translationX = translationXAnimatable.value\n        rotationZ = rotationAnimatable.value\n    }, \n    painter = painterResource(id = R.drawable.image)\n)\n``` \n\n### Executing choreography\n\nOnce choreography is ready it's time to dance! 💃🕺.\n\n#### One time dance\n\nYou can execute the choreography once by calling `dance` function. If you wish to get callback after execution of choreography then you can pass trailing lambda.\n\n```kotlin\nkoreography.dance(scope = coroutineScope) {\n    // onDanceFinished : Optional trailing lambda\n}\n```\n\n#### Repeat dance\n\nYou can execute the choreography multiple times by calling `repeatDance` function. Following call executes choreography three times.\n\n```kotlin\nkoreography.repeatDance(count = 3, scope = coroutineScope) {\n    // onDanceFinished : Optional trailing lambda\n}\n```\n\n#### Infinite dance\n\nYou can execute the choreography forever until composition is alive.\n\n```kotlin\nkoreography.danceForever(scope = coroutineScope){\n    // onDanceFinished : Optional trailing lambda\n}\n```\n\n\u003e Please note the `coroutineScope` should be obtained through `rememberCoroutineScope()`. Make sure you pass coroutine scope which will get cleared once you exit composition.\n\n### Executing choreography based on state change 🚀\n\nExecuting choreography based on state change is also supported. This API is similar to [`LaunchedEffect`](https://developer.android.com/jetpack/compose/side-effects#launchedeffect) API of compose side effects.\n\nIn the following example, we are executing choreography passed in the trailing lambda of `LaunchKoreography` composable on a state value change. Choreography contains two animations that will be executed sequentially.\n\n```kotlin\nval alphaAnimatable = remember {\n    Animatable(0f)\n}\n\nval scaleAnimatable = remember {\n    Animatable(0f)\n}\n\nLaunchKoreography(state) {\n    move(\n        animatbale = alphaAnimatable,\n        targetValue = 1f,\n        animationSpec = tween(500)\n    )\n    \n    move(\n        animatbale = scaleAnimatable,\n        targetValue = 2f,\n        animationSpec = tween(500)\n    )\n}\n.\n.\n.\nImage(\n    modifier = Modifier.graphicsLayer {\n        alpha = alphaAnimatable.value\n        scaleX = scaleAnimatable.value\n    }, \n    painter = painterResource(id = R.drawable.image)\n)\n```\n\n### Samples\n\nThere is endless possibilities with power of coroutines and compose animation API! Here are some free lottie animations recreated using koreography. You can find the source code in the sample app.\n\nhttps://github.com/sagar-viradiya/koreography/assets/11586051/54c80649-f1b7-454e-a8d2-5ca56ffb4ccc\n\nhttps://github.com/sagar-viradiya/koreography/assets/11586051/75b5c527-34c4-4552-a6a3-8480766fb88e\n\nhttps://github.com/sagar-viradiya/koreography/assets/11586051/f57ca6f9-e1eb-4e9d-883a-bd8203e81441\n\nhttps://github.com/sagar-viradiya/koreography/assets/11586051/766f23f1-f21b-4353-91b8-437672e756aa\n\nhttps://github.com/sagar-viradiya/koreography/assets/11586051/8cdcf0ab-988f-4dde-92e9-cd5a20490bf6\n\n## Contribution\n\nThis is the early preview and unfortunately it is not ready to accept any contribution yet. Once this is stable enough contribution guidelines will be updated here. Meanwhile feel free to start [GitHub Discussions](https://github.com/sagar-viradiya/koreography/discussions) for feature request and improvements.\n\n## License\n\n    Copyright 2022 Koreography Contributors\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagar-viradiya%2Fkoreography","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagar-viradiya%2Fkoreography","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagar-viradiya%2Fkoreography/lists"}