jvm.mp4
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 theSpinnable
is front facing -
back
: Your composable content when theSpinnable
is back facing -
state
: Defines in what state is yourSpinnable
. The following types are available:
None
: No movement allowed
Manual
: It can beManual.Horizontal
,Manual.Vertical
orManual.Both
. Each makes the component spinnable to the according axis.
Automatic
: Has thehorizontalSpeed
andverticalSpeed
. It receives aFloat
value.360F
makes 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")
}