Android:Translation and Rotation Animation simultaneously

前端 未结 1 1211
长情又很酷
长情又很酷 2021-01-02 07:45

I want to show two animation simultaneously programatically not in XML file.It should ROTATE and TRANSLATE how can I do that?

Please suggest me som

相关标签:
1条回答
  • 2021-01-02 08:20

    I have done it Using ANIMATIONSET we can do this.

    AnimationSet snowMov1 = new AnimationSet(true);
            RotateAnimation rotate1 = new RotateAnimation(0,360, Animation.RELATIVE_TO_SELF,0.5f , Animation.RELATIVE_TO_SELF,0.5f );
            rotate1.setStartOffset(50);
            rotate1.setDuration(9500);
            snowMov1.addAnimation(rotate1);
            TranslateAnimation trans1 =  new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.1f, Animation.RELATIVE_TO_PARENT, 0.3f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.9f);
            trans1.setDuration(12000);
            snowMov1.addAnimation(trans1);
    

    In this way we can made set for multiple animations.

    0 讨论(0)
提交回复
热议问题