
UI library facilitates spinning components using customizable states for manual or automatic rotation, supporting both composable and XML configurations. Offers options for rotation speed and axis control.
Kotlin multiplatform ui library to spin components. We support jvm (desktop) and Android. Check out the wiki page for
Compose,
Desktop and
Android usage!
- iOS support
- Api design improvements
- Improve performance, if needed
- Add the option to snap on release to closest side
- Add the option to set component rotation on demand
SpinnableView(
front: @Composable () -> Unit,
back: @Composable () -> Unit,
state: SpinnableState = SpinnableState.Manual.Both,
modifier: Modifier = Modifier
)
front: Your composable content when the Spinnable is front facing
back: Your composable content when the Spinnable is back facing
state: Defines in what state is your Spinnable. The following types are available:
None: No movement allowed
Manual: It can beManual.Horizontal,Manual.VerticalorManual.Both. Each makes the component spinnable to the according axis.
Automatic: Has thehorizontalSpeedandverticalSpeed. It receives aFloatvalue.360Fmakes the component spin 360 degrees per second.
<williankl.spinnable.core.SpinnableView
android:id="@+id/spinnable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
app:state="state": This field can be:
none: This one makes the spinnable static. Unable to move.
manual: Comes with a combo ofapp:isVerticalEnabled="boolean"andapp:isHorizontalEnabled="boolean". The default value for both fields, if not passed, istrue.
automatic: Comes with a combo ofapp:horizontalSpeed="float"andapp:verticalSpeed="float". The default speed for both fields, if not passed, is360F
Add these on build.gradle.kts file of the target module.
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.williankl.spinnable:spinnable-core:$spinnableVersion")
}
Kotlin multiplatform ui library to spin components. We support jvm (desktop) and Android. Check out the wiki page for
Compose,
Desktop and
Android usage!
- iOS support
- Api design improvements
- Improve performance, if needed
- Add the option to snap on release to closest side
- Add the option to set component rotation on demand
SpinnableView(
front: @Composable () -> Unit,
back: @Composable () -> Unit,
state: SpinnableState = SpinnableState.Manual.Both,
modifier: Modifier = Modifier
)
front: Your composable content when the Spinnable is front facing
back: Your composable content when the Spinnable is back facing
state: Defines in what state is your Spinnable. The following types are available:
None: No movement allowed
Manual: It can beManual.Horizontal,Manual.VerticalorManual.Both. Each makes the component spinnable to the according axis.
Automatic: Has thehorizontalSpeedandverticalSpeed. It receives aFloatvalue.360Fmakes the component spin 360 degrees per second.
<williankl.spinnable.core.SpinnableView
android:id="@+id/spinnable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
app:state="state": This field can be:
none: This one makes the spinnable static. Unable to move.
manual: Comes with a combo ofapp:isVerticalEnabled="boolean"andapp:isHorizontalEnabled="boolean". The default value for both fields, if not passed, istrue.
automatic: Comes with a combo ofapp:horizontalSpeed="float"andapp:verticalSpeed="float". The default speed for both fields, if not passed, is360F
Add these on build.gradle.kts file of the target module.
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.williankl.spinnable:spinnable-core:$spinnableVersion")
}