Android 安卓:如何制作一个好的心跳动画?
这是我的解决方案 anim/pulse.xmlAndroid 安卓:如何制作一个好的心跳动画?,android,xml,animation,android-animation,objectanimator,Android,Xml,Animation,Android Animation,Objectanimator,这是我的解决方案 anim/pulse.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <scale android:duration="300" android:fromXScale="1" android:fromYScale="1" android:pivotX=
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="300"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="reverse"
android:toXScale="0.75"
android:toYScale="0.75"
android:interpolator="@android:interpolator/bounce" />
<scale
android:duration="100"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="reverse"
android:toXScale="1.25"
android:toYScale="1.25"
android:interpolator="@android:interpolator/bounce" />
</set>
我不满意,因为真正跳动的心脏有更优雅的收缩。如何改进
编辑:我认为一个好的效果应该是模仿心跳。紧接着又一次的快速收缩。也许最后一个可以在上半场快速,然后在下半场缓慢逆转。有没有办法让所有这些效果互相触发?真正跳动的心脏是你不想看到的令人毛骨悚然的东西……你的使用案例是什么?医疗/体育应用程序?情人节应用程序?好的,我知道:)这只是一个简单的效果,可以吸引用户对特定图像的注意。请。!!!这个问题不应该关闭…请查看此链接的:pumpHeart()方法和scaleUpListener。他们使用
ViewPropertyAnimator
制作了心跳动画。还可以显示动画工作方式的示例。
ImageView imageView = (ImageView) findViewById(R.id.image);
imageView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.pulse));