如何在Jetpack Compose中实现点击缩放动画?

huangapple go评论66阅读模式
英文:

How to implement a tap-to-zoom animation in Jetpack Compose?

问题

当我第一次点击图像时,我想要增加它的缩放,当我再次点击它时,我希望它恢复到原始缩放比例。

我想要的效果与此相同,我在Android网站上找到了它,但我希望在Jetpack Compose中实现:
https://developer.android.com/develop/ui/views/animations/zoom

谢谢帮助。

英文:

When I click on an image for the first time I want to increase its scale and when I click on it again I want it to return to its original scale.

What I want is exactly like this, I found it on the Android website but I want it in Jetpack Compose:
https://developer.android.com/develop/ui/views/animations/zoom

Thanks for help

答案1

得分: 1

你可以使用这个库来实现类似以下功能:

Jetpack Compose共享元素过渡

使用这个库,你可以声明具有相同键的元素,并在两个屏幕中使用它们,然后元素会以缩放动画显示。

希望对你有帮助。

英文:

you can use this library for do something like that :

Shared Elements Transition for Jetpack Compose

with this library you can declare element with same key and use in two screen then elements show with zoom animation

hope helps you

huangapple
  • 本文由 发表于 2023年6月27日 19:30:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76564415.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定