1
I have the following routine:
private void move(float graus1, float graus2, float xx1, float xx2, float yy1, float yy2) {
animSet = new AnimationSet(false);
rotate = new RotateAnimation(graus1,graus2,Animation.RELATIVE_TO_SELF, .5f,Animation.RELATIVE_TO_SELF, 2f);
translate = new TranslateAnimation(xx1, xx2, yy1, yy2);
rotate.setDuration(2000);
translate.setDuration(2000);
translate.setStartOffset(rotate.getDuration());
animSet.addAnimation(rotate);
animSet.addAnimation(translate);
animSet.setInterpolator(new LinearInterpolator());
animSet.setFillAfter(true);
animSet.setStartOffset(0);
myimagem.startAnimation(animSet);
}
It works beauty. However, when the Rotate is finished, there is a stop to start Translate. How can there not be this pause, and the image follow at the same speed all the way? I tried everything. I changed the interpolator with several types and nothing... I appreciate some help.
ramaral, very well explained. It worked... Very Obg...
– Adonis
ramaral, I came up with two other doubts: How do I get the X and Y of the image at a certain point in the journey? in the example above the total animating time is 4000. How do I know what is the value of X and Y, for example, in the 2500? And the other: How still in the execution of the animation I change the time (setDuration), ie I put 2000 and 2000, more at the click of a button I want to decrease or increase the speed, for example, to 1000 and 1000 or 3000 and 3000, etc...?
– Adonis
All this is possible to be done(at least the first). It will be easier to do if instead of View Animations which is obsolete, use Property Animations. However, this is not something that has already been done, you may have to use a Valueanimator and implement these requirements.
– ramaral
A good source of information about animations: https://github.com/codepath/android_guides/wiki/Animations
– ramaral
ramaral, I’m already researching and studying what you commented above... Do you also understand Sqlite3? Because I posted a doubt... Hugs.
– Adonis