What is the difference between animator and animation?

It seems that Animation and Animators allow me to animate properties (position, opacity, scale, rotation, etc.) on objects, and it's hard for me to distinguish between the use case for both. When should an animator be used against animation and vice versa?

+60
android android-animation
Jan 29 '15 at 17:12
source share
3 answers

Animations are older versions of Animators . Animators, which are introduced in version 3.0, will help to overcome some of the shortcomings that are in animations.

Animations change the visual representation of an object. This is fine if you just change the opacity, but it causes problems when translating, rotating, or scaling objects. In the old days before Animators , if you moved an object, you had to re-mock it with the new coordinates. This can be quite difficult depending on where the object is moving.

Animators, on the other hand, modify the physical properties of objects. This means that if you move the view to a new location, the touch coordinates will be displayed in the new location without any other intervention.

Personally, I no longer use animation unless I develop API 2.3 or less. Fortunately, this is becoming a problem. There are also some old classes that still use the animation APIs, especially when it comes to using xml resources, such as the android.support.v4.app.FragmentTransaction class (regular FragmentTransaction supports Animators).

As a side note, the NineOldAndroids project was designed to simulate the functionality of animators, but using animations so that you can create applications that work all the way to 1.6.

+87
Jan 29 '15 at 17:25
source share
โ€” -

An Animation object animates a view image. If you use this, for example, to move a button around the screen, you cannot click on it in a new visible position, because it was not really moved, but only its bitmap representation was translated. You also cannot change its proportions, as you make changes to the bitmap image. If you use XML files, put them in the anim folder.

An Animator object animates a view property (such as a field or width). If you use this to move the button around the screen, you can capture clicks on it in new visible places. If you use XML files, put them in the animator folder.

If you only need cosmetic effects, such as the fading in or broadcast of a small look, using Animation will be more efficient since it does not call layout() or measure() methods. If you need to capture actions such as click events, use Animator .

+3
Sep 05 '18 at 20:46
source share

Toto Bsjdbzbdjxjdbdjxbdbdlslqndkdldkskzlskfnfkfkjffnfkckfnenxodbdbfbxjdksd

Dkdndksk๐Ÿ˜๐Ÿ˜๐Ÿ˜Š๐Ÿ˜‡๐Ÿ˜Š๐Ÿฆ๐Ÿท๐Ÿฎ

  /\_/\ ( -_- ) / |> 
0
Jun 19 '19 at 0:58
source share



All Articles