Package-level declarations

Types

Link copied to clipboard

进入状态,表示页面即将进入,是Transform的开始

Link copied to clipboard
Link copied to clipboard
data class ExitingState(val progress: Float) : TransformState

ResumeStateExitState的中间态,用于手势过程,代表正在退出

Link copied to clipboard

退出状态/结束状态;transform的结束

Link copied to clipboard
Link copied to clipboard

类ios的Modal手势实现,在页面route时设置modal即可使用

Link copied to clipboard

无手势实现

Link copied to clipboard

普通的默认手势实现,在页面route时设置normal即可使用

Link copied to clipboard

显示状态

Link copied to clipboard
data class StoppingState(val progress: Float) : TransformState

StopStateResumeState的中间态,用于手势过程,代表正在暂停

Link copied to clipboard

暂停状态;代表后一个页面已经显示了,当前界面已经变为前一个页面,该页面暂停

Link copied to clipboard
data class Transform

一个transform代表的是一次页面变换

Link copied to clipboard
Link copied to clipboard

描述界面变换的状态,以及进度。需要注意的是TransformState类簇仅描述界面变换,不代表页面生命周期。

Link copied to clipboard
abstract class TransformWrap

变换包裹层,在这里可以同时控制当前页面和前一个页面的变化。

Link copied to clipboard

手势包裹层的作用域,该类主要是管理一些工作,比如:让页面内容也可以控制页面的手势

Functions

Link copied to clipboard
fun TransformState.between(resume: Float, exit: Float, pause: Float = exit): Float

该方法用于计算resume - exit和resume - pause之间的变化关系。

Link copied to clipboard
Link copied to clipboard
fun expandHorizontally(animationSpec: FiniteAnimationSpec<IntSize> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntSize.VisibilityThreshold ), expandFrom: Alignment.Horizontal = Alignment.End, clip: Boolean = true, initialWidth: (fullWidth: Int) -> Int = { 0 }): EnterTransition
Link copied to clipboard
fun expandIn(animationSpec: FiniteAnimationSpec<IntSize> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntSize.VisibilityThreshold ), expandFrom: Alignment = Alignment.BottomEnd, clip: Boolean = true, initialSize: (fullSize: IntSize) -> IntSize = { IntSize(0, 0) }): EnterTransition
Link copied to clipboard
fun expandVertically(animationSpec: FiniteAnimationSpec<IntSize> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntSize.VisibilityThreshold ), expandFrom: Alignment.Vertical = Alignment.Bottom, clip: Boolean = true, initialHeight: (fullHeight: Int) -> Int = { 0 }): EnterTransition
Link copied to clipboard
fun fadeIn(animationSpec: FiniteAnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow), initialOffset: Float = 0.0f): EnterTransition
Link copied to clipboard
fun fadeOut(animationSpec: FiniteAnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow), targetAlpha: Float = 0.0f): ExitTransition
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <T : Any> rememberAnchoredDraggableState(any: Any, initialValue: T, anchors: DraggableAnchors<T>, animationSpec: AnimationSpec<Float> = spring(), positionalThreshold: (distance: Float) -> Float = { it * 0.5f }, velocityThreshold: () -> Float = { 10f }, confirmValueChange: (T) -> Boolean = { true }): AnchoredDraggableState<T>
Link copied to clipboard
fun rememberDraggableModifier(orientation: Orientation = Orientation.Horizontal, reverseDirection: Boolean = false): Modifier

由拖拽手势生成的两个modifier,具体可参考ModalTransformWrapNormalTransformWrap 该方法有一定的局限性,如果需要不同的手势操作请自行实现

Link copied to clipboard
Link copied to clipboard
fun scaleIn(animationSpec: FiniteAnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow), initialScale: Float = 0.0f, transformOrigin: TransformOrigin = TransformOrigin.Center): EnterTransition
Link copied to clipboard
fun scaleOut(animationSpec: FiniteAnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow), targetScale: Float = 0.0f, transformOrigin: TransformOrigin = TransformOrigin.Center): ExitTransition
Link copied to clipboard
fun share(vararg keys: String, animationSpec: FiniteAnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow), shareAnimationSpec: FiniteAnimationSpec<Rect> = spring(visibilityThreshold = Rect.VisibilityThreshold), wrap: TransformWrap = NormalShareTransformWrap(shareAnimationSpec, *keys)): Transform

共享元素,当需要使用共享元素动画时,需要使用该transform

Link copied to clipboard
fun shrinkHorizontally(animationSpec: FiniteAnimationSpec<IntSize> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntSize.VisibilityThreshold ), shrinkTowards: Alignment.Horizontal = Alignment.End, clip: Boolean = true, targetWidth: (fullWidth: Int) -> Int = { 0 }): ExitTransition
Link copied to clipboard
fun shrinkOut(animationSpec: FiniteAnimationSpec<IntSize> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntSize.VisibilityThreshold ), shrinkTowards: Alignment = Alignment.BottomEnd, clip: Boolean = true, targetSize: (fullSize: IntSize) -> IntSize = { IntSize(0, 0) }): ExitTransition
Link copied to clipboard
fun shrinkVertically(animationSpec: FiniteAnimationSpec<IntSize> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntSize.VisibilityThreshold ), shrinkTowards: Alignment.Vertical = Alignment.Bottom, clip: Boolean = true, targetHeight: (fullHeight: Int) -> Int = { 0 }): ExitTransition
Link copied to clipboard
fun slideIn(animationSpec: FiniteAnimationSpec<IntOffset> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntOffset.VisibilityThreshold ), initialOffset: (fullSize: IntSize) -> IntOffset): EnterTransition
Link copied to clipboard
fun slideInHorizontally(animationSpec: FiniteAnimationSpec<IntOffset> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntOffset.VisibilityThreshold ), initialOffsetX: (fullWidth: Int) -> Int = { -it / 2 }): EnterTransition
Link copied to clipboard
fun slideInVertically(animationSpec: FiniteAnimationSpec<IntOffset> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntOffset.VisibilityThreshold ), initialOffsetY: (fullHeight: Int) -> Int = { -it / 2 }): EnterTransition
Link copied to clipboard
fun slideOut(animationSpec: FiniteAnimationSpec<IntOffset> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntOffset.VisibilityThreshold ), targetOffset: (fullSize: IntSize) -> IntOffset): ExitTransition
Link copied to clipboard
fun slideOutHorizontally(animationSpec: FiniteAnimationSpec<IntOffset> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntOffset.VisibilityThreshold ), targetOffsetX: (fullWidth: Int) -> Int = { -it / 2 }): ExitTransition
Link copied to clipboard
fun slideOutVertically(animationSpec: FiniteAnimationSpec<IntOffset> = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntOffset.VisibilityThreshold ), targetOffsetY: (fullHeight: Int) -> Int = { -it / 2 }): ExitTransition