share

fun share(vararg keys: Any, animationSpec: FiniteAnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow), shareAnimationSpec: FiniteAnimationSpec<Rect> = spring(visibilityThreshold = Rect.VisibilityThreshold), gesture: SimpleGesture = normalSimpleGesture): Transform

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

Parameters

keys

指定参与该次页面切换的共享控件

animationSpec

页面转换动画使用

shareAnimationSpec

共享元素变换使用,控制共享元素尺寸的变化

gesture

简单手势设置,支持设置手势的模式和方向 需要注意的是,如果给shareAnimationSpecanimationSpec设置tween那么请给另一个也加上,并且给予相同的时间,如此两者的进度才是一致的。