[ad_1]
I have this RotateAnimation from a project on GitHub and I want to apply the same rotation to my Image (Compass with needle arrow inside)
Here are the parameters of RotateAnimation:
public RotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)
Here is my code:
angleCompass.value = -angle
val an = RotateAnimation(
-currentAngle, -angle,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f
)
currentAngle = azimuth
an.duration = 500
an.repeatCount = 0
an.fillAfter = true
binding.imgCompass.startAnimation(an)
val anim = RotateAnimation(
-currentAngle + qiblaDir, -azimuth,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f
)
angleNeedle.value = -azimuth
currentAngle = azimuth
anim.duration = 500
anim.repeatCount = 0
anim.fillAfter = true
binding.imgQiblaArrow.startAnimation(anim)
How can I apply the same animation in compose?
[ad_2]