How to explain the Coordinate system on Android animation? -


as know , android coordinate system start top left corner of android screen. x-axis down growth , y-axis right growth.but found it's not right animation.

for example, initialized translateanimation using constructed function:

translateanimation ta = new translateanimation(0.0f, 200, 0.0f, 200);   

does coordinate system have changed ? found didn't start top left corner.

then initialized other translateanimation moving , right direction :

translateanimation ta = new translateanimation(0.0f, 200, 0.0f, -200);  ta.setreaptmode(animation.reverse); 

the same behavior found. confused it.

i believe constructor translateanimation uses deltas. see this. or @ constructor sig. : (float fromxdelta, float toxdelta, float fromydelta, float toydelta). if want anim. jump up first, use negative third ctor param.

more precisely:

an animation can never start until after layout has been measured. 1 shouldn't have worry how works beyond algorithm , can take control of strategies setting layout parameters. in short, time animation might started, know you want view on screen, because set layout parameters.

translate animation takes deltas that position. current animation shouldn't start top left, rather wherever layout params evaluated onmeasure.

some say- how annoying. it's gonna complicated if want simple up-down type animations... well, here's advisable development strategy; snould make android animation development breeeze. set animationlistener on every animation. in onanimationend, in possibly parametized way, reset layout parameters on view animating expect be. way, you'll no surprising "jumps" when re-apply animation again. may need invalidate in circumstances, or clearanimation. reason works measure pass caused come round again , you'll have new offset translateanimation. finally, may want resetting posted message queue of view using post(runnable runnable) in listener, you're off last pass of animation draw.

i found android animations can surprise , cause jumpy behaviour. if this, constructors taking delta params shouldn't confusing again.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -