How Android custom animations are implemented

Source: Internet
Author: User

For Androi frame animations, GIF images can be made, and sometimes in order to dynamically generate frame animations, you need to use code to build

The Animationdrawable class uses Addframe to add frames.

Use start in the Animationdrawable class to start the animation.

Use stop in the Animationdrawable class to stop the animation.


In addition, for the understanding of the tweened animation prone to errors in the place, correct the following:

Rotateanimation ra = new Rotateanimation (fromdegrees, Todegrees, Pivotx, Pivoty)

Pivotx,pivoty The actual pixel when the value is greater than 1

Rotateanimation ra = new Rotateanimation (fromdegrees, Todegrees, Pivotxtype, Pivotxvalue, Pivotytype, PivotYValue)

Pivotx, Pivoty when a value greater than 1 represents a proportional position


Custom animations:

public class Customanimation extends Animation {@Overrideprotected void applytransformation (float interpolatedtime, Transformation T) {super.applytransformation (interpolatedtime, T); T.getmatrix (). Settranslate ((float) (Math.sin (10* Interpolatedtime) *50), 0);}}





How Android custom animations are implemented

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.