Hey. Say, is any suitable article on vector animation (preferably with examples). I looked through the forums, read, but so far not really caught up. Made the application, it was necessary to make 2 loop animations, but with the ability to change the speed of this very animation. Cut raster images, one picture - one frame, respectively. Implemented in such a way that it is completely inconvenient, and bad for the application and the subsequent work with this animation.

public void startFrameAnimation() { BitmapDrawable frame1 = (BitmapDrawable) getResources().getDrawable( R.drawable.left0); BitmapDrawable frame2 = (BitmapDrawable) getResources().getDrawable( R.drawable.left1); BitmapDrawable frame3 = (BitmapDrawable) getResources().getDrawable( R.drawable.left2); BitmapDrawable frame4 = (BitmapDrawable) getResources().getDrawable( R.drawable.left3); BitmapDrawable frame5 = (BitmapDrawable) getResources().getDrawable( R.drawable.left4); BitmapDrawable frame6 = (BitmapDrawable) getResources().getDrawable( R.drawable.left_full); mAnimationDrawable = new AnimationDrawable(); mAnimationDrawable.setOneShot(false); mAnimationDrawable.addFrame(frame1, DURATION); mAnimationDrawable.addFrame(frame2, DURATION); mAnimationDrawable.addFrame(frame3, DURATION); mAnimationDrawable.addFrame(frame4, DURATION); mAnimationDrawable.addFrame(frame5, DURATION); mAnimationDrawable.addFrame(frame6, DURATION+250); manimLeft.setBackground(mAnimationDrawable); if (!mAnimationDrawable.isRunning()) { mAnimationDrawable.setVisible(true, true); } } public void startFrameAnimation2() { BitmapDrawable frame1 = (BitmapDrawable) getResources().getDrawable( R.drawable.right0); BitmapDrawable frame2 = (BitmapDrawable) getResources().getDrawable( R.drawable.right1); BitmapDrawable frame3 = (BitmapDrawable) getResources().getDrawable( R.drawable.right2); BitmapDrawable frame4 = (BitmapDrawable) getResources().getDrawable( R.drawable.right3); BitmapDrawable frame5 = (BitmapDrawable) getResources().getDrawable( R.drawable.right4); BitmapDrawable frame6 = (BitmapDrawable) getResources().getDrawable( R.drawable.right_full); mAnimationDrawable2 = new AnimationDrawable(); mAnimationDrawable2.setOneShot(false); mAnimationDrawable2.addFrame(frame1, DURATION); mAnimationDrawable2.addFrame(frame2, DURATION); mAnimationDrawable2.addFrame(frame3, DURATION); mAnimationDrawable2.addFrame(frame4, DURATION); mAnimationDrawable2.addFrame(frame5, DURATION); mAnimationDrawable2.addFrame(frame6, DURATION+250); manimRight.setBackground(mAnimationDrawable2); if (!mAnimationDrawable2.isRunning()) { mAnimationDrawable2.setVisible(true, true); } } 

Now made one vector drawing, consisting of several sections. These same sections should be poured in turn in different colors. That's actually all the animation. So the question is: how can I make this animation, determine for which frame which section to fill in and how can I control the speed of the animation? In principle, I understand that all this can be done in xml, but from the code I have to speed up or slow down this animation. What are the ways to implement, guys? Thank.

  • 2
    Try through this resource https://shapeshifter.design/ . The truth is not sure that it will be possible to change the animation speed at runtime. - eugeneek
  • @eugeneek thanks, interesting stuff. everything is more convenient than poking with handles) and with runtime it is yes, I will think something - Cotton Pericranium
  • So in Android, there is already a morph animation for this with API 21. I mean, write an example or what. By the way, you can change the speed in runtime, but you can clumsily, completely substitute, of the anim_vector class. Perhaps there is a dynamic way, but something I didn’t see. - Shwarz Andrei

0