Android ShapeDrawable Translate Transform
-
13-04-2021 - |
Question
I have a class that extends View, in which I place an instance of a ShapeDrawable
, using shapeDrawable.draw(canvas)
in the onDraw()
method.
I would like to create a translate animation that would move the ShapeDrawable
object to another (x,y) position in a given amount of time.
Is there a simple way to achieve this in Android 1.6? Or is there something that I can change in my approach that could help simplify this task?
Solution
You Could try this Although you would have to add a timer
public void changePos (float dx, float dy) {
mPosX += dx;
mPosY += dy;
this.invalidate ();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow