share

fun share(vararg keys: Any, animationSpec: FiniteAnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow), shareAnimationSpec: FiniteAnimationSpec<Rect> = spring(visibilityThreshold = Rect.VisibilityThreshold), wrap: TransformWrap = NormalShareTransformWrap(shareAnimationSpec, *keys)): Transform

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

Parameters

keys

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

animationSpec

页面转换动画使用

shareAnimationSpec

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

wrap

变换包装类,可以在这里处理变换过程中两个页面的一些变化,可以通过该类给共享元素变换加上手势退出,可参考NormalShareTransformWrap 需要注意的是,如果给shareAnimationSpecanimationSpec设置tween那么请给另一个也加上,并且给予相同的时间,如此两者的进度才是一致的。