I have a code like this:
AnimationSet s1 = new AnimationSet(true); TranslateAnimation tr1 = new TranslateAnimation(0, 0, -100, -200); tr1.setDuration(6500); s1.addAnimation(tr1); Paint paint = new Paint(); Bitmap b = Bitmap.createBitmap(90, 90, Bitmap.Config.ARGB_8888); Canvas c1 = new Canvas(b); c1.drawCircle(50, 100, 20, paint); AnimationSet s2 = new AnimationSet(true); TranslateAnimation tr2 = new TranslateAnimation(0, 0, -140, -260); tr2.setDuration(6500); s1.addAnimation(tr2); Canvas c2 = new Canvas(b); c2.drawCircle(150, 140, 20, paint);
How to start s1 animation on c1 canvas and s2 animation on c2 canvas? If I am a subclass of the View class, then I can call the startAnimation method in the view class, but how can I associate the canvases with the animation above using the View class? Sample code will be very helpful. I could not find a pure Android API that allows me to specify the purpose of the animation. There should be an API that sets the sequence of animations, specifying any target graphic object, which in my case is a canvas object ((and not just built-in graphic objects such as Button) on which the animation sequence should run on.
source share