AXAnimation
AXAnimation is an Android Library which can simply animate views and everything!
Install / Use
/learn @Aghajari/AXAnimationREADME
AXAnimation
<p align="center"><img src="/images/AXAnimation.jpg"></p>AXAnimation is an Android Library which can simply animate views and everything!
Table of Contents
Introduction
This library is made up of three main sections that you should be familiar with before you begin.
- Rule
- RuleSection
- PreRule
Rule :
Each Rule does a specific job for the Animation. Rules will create the Animators of animation methods.
There are different types of rules :
- PropertyRule : Uses
ObjectAnimatorforalpha(),rotation(),scale()and etc. Also It has a subclass called PropertyValueRule which usesValueAnimatorfor more customiztions. - RuleSet : Can create multi rules in just one rule.
- NotAnimatedRule : Some Rules have no Animators but they can update the target's state such as
bringViewToFrontorsendViewToBack. - DrawRule : Will draw Lines, Arcs, Shapes, Texts and etc on a
DrawableLayoutby canvas.
RuleSection :
Each section contains some Rules which will play together. but the sections will play sequentially. You can have several sections in an Animation.
There is also a WaitRule which can add delay between each section.
PreRule :
PreRule will prepare target for an Animation just before starting it. For Example copyOfView(...) makes a Placeholder of view.
Thats it!
This was a quick introduction for AXAnimation.
Good News: You don't need to create rules or anything by yourself, they are already made and waiting for your command to be executed.
Installation
AXAnimation is available in the mavenCentral(), so you just need to add it as a dependency (Module gradle)
Gradle
implementation 'io.github.aghajari:AXAnimation:1.0.1'
Maven
<dependency>
<groupId>io.github.aghajari</groupId>
<artifactId>AXAnimation</artifactId>
<version>1.0.1</version>
<type>pom</type>
</dependency>
USAGE
<img src="/images/0.gif" alt="sample" title="sample" width="250" height="180" align="right" />- Let's start with
alpha()Andscale()
AXAnimation.create()
.duration(1000)
.alpha(1f)
.nextSection()
.scale(1.5f, 1.25f, 1.8f)
.start(target);
<img src="/images/1_0.gif" alt="sample" title="sample" width="250" height="180" align="right" />
resize(gravity, width, height)
AXAnimation.create().dp()
.duration(500)
.resize(Gravity.CENTER, width, height)
.start(target);
<br>
<br>
<img src="/images/1_1.gif" alt="sample" title="sample" width="250" height="180" align="right" />
AXAnimation.create().dp()
.duration(500)
.resize(Gravity.TOP | Gravity.RIGHT, width, height)
.start(target);
<br>
<br>
<img src="/images/2.gif" alt="sample" title="sample" width="250" height="180" align="right" />
resize(left, top, right, bottom)ORresize(Rect... layouts)
AXAnimation.create().dp()
.duration(500)
.resize(left, top, right, bottom)
.start(target);
<br>
<img src="/images/3.gif" alt="sample" title="sample" width="250" height="180" align="right" />
skew(kx, ky)ORskew(PointF... values)&imageSkew(...)
AXAnimation.create()
.duration(500)
.skew(0.3f, 0.3f)
.start(target);
<br>
<img src="/images/4.gif" alt="sample" title="sample" width="250" height="180" align="right" />
matrix(Matrix... matrices)&imageMatrix(...)
Matrix matrix = new Matrix();
matrix.setSkew(0.15f, 0.15f);
matrix.postScale(1.5f, 1.5f);
matrix.postTranslate(-100, -100);
AXAnimation.create()
.duration(1000)
.matrix(matrix)
.nextSectionWithDelay(500)
.reversePreviousRule()
.start(target);
<img src="/images/5.gif" alt="sample" title="sample" width="250" height="180" align="right" />
backgroundColor(int... colors)
AXAnimation.create()
.duration(1000)
.backgroundColor(Color.MAGENTA)
.nextSectionWithDelay(500)
.reversePreviousRule()
.start(target);
<img src="/images/6.gif" alt="sample" title="sample" width="250" height="200" align="right" />
background(Drawable... drawables)
GradientDrawable gd1 = new GradientDrawable();
gd1.setColors(new int[]{Color.RED, Color.BLUE});
gd1.setOrientation(GradientDrawable.Orientation.TOP_BOTTOM);
GradientDrawable gd2 = new GradientDrawable();
gd2.setColors(new int[]{Color.BLUE, Color.GREEN});
gd2.setOrientation(GradientDrawable.Orientation.TL_BR);
gd2.setCornerRadius(100);
gd2.setStroke(20, Color.RED, 0, 0);
ColorDrawable cd = new ColorDrawable(Color.MAGENTA);
AXAnimation.create()
.duration(4000)
.background(gd1, gd2, cd)
.start(target);
<img src="/images/7.gif" alt="sample" title="sample" width="250" height="200" align="right" />
flipHorizontalAndflipVertical
AXAnimation.create()
.duration(1000)
.flipHorizontalToHide()
.nextSectionWithDelay(600)
.flipHorizontalToShow()
.nextSectionWithDelay(600)
.flipVerticalToHide()
.nextSectionWithDelay(600)
.flipVerticalToShow()
.start(target);
<img src="/images/8.gif" alt="sample" title="sample" width="250" height="200" align="right" />
drawLine(...)
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(20);
paint.setColor(Color.WHITE);
LiveSize y = LiveSize.create(AXAnimation.CONTENT_HEIGHT).divide(2);
LiveSize left = LiveSize.create(16);
LiveSize right = LiveSize.create(AXAnimation.CONTENT_HEIGHT).minus(16);
AXAnimation.create().dp()
.duration(1000)
.repeatCount(AXAnimation.INFINITE)
.repeatMode(AXAnimation.REVERSE)
.drawLine("line_key", true, Gravity.CENTER, paint, left, y, right, y)
.start(target);
<img src="/images/9.gif" alt="sample" title="sample" width="250" height="200" align="right" />
drawArc(...)
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(20);
paint.setColor(Color.WHITE);
LiveSize cx = LiveSize.create(AXAnimation.CONTENT_WIDTH).divide(2);
LiveSize cy = LiveSize.create(AXAnimation.CONTENT_HEIGHT).divide(2);
AXAnimation.create().dp()
.waitBefore(1000)
.duration(2500)
.drawArc("arc_key", true, paint, cx, cy, 56, false, -90, 270, 200, 320, 270, 360)
.nextSectionWithDelay(500)
.reversePreviousRuleSection()
.start(target);
<p align="center"><b>And many other interesting animations!</b></p>
Let's see a few more custom animations.
<br> <img src="/images/activity_1.gif" alt="sample" title="sample" width="270" height="480" align="right" />drawPath(...)
Paint paint = new Paint();
paint.setColor(Color.RED);
paint.setStrokeWidth(20);
paint.setStyle(Paint.Style.STROKE);
Path path = new Path();
path.moveTo(100, 100);
path.lineTo(600, 100);
path.lineTo(600, 500);
path.lineTo(100, 500);
path.lineTo(100, 1000);
AXAnimation.create().dp()
.duration(1000)
.drawPath("path", true, Gravity.CENTER, paint, path)
.backgroundColor(Color.BLUE)
.textColor(Color.WHITE)
.unlockY().unlockX()
.toTop(150)
.toRight(130)
.nextSectionWithDelay(500)
.reversePreviousRuleSection()
.start(findViewById(R.id.view2));
<img src="/images/activity_2.gif" alt="sample" title="sample" width="270" height="480" align="right" />
matrix(...)
Matrix matrix = new Matrix();
matrix.setSkew(0.15f, 0.15f);
matrix.postScale(2f,2f);
matrix.postTranslate(-150,-100);
AXAnimation.create()
.duration(1000)
.toCenterOf(AXAnimation.PARENT_ID)
.nextSectionWithDelay(500)
.matrix(matrix)
.start(findViewById(R.id.view2));
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<img src="/images/activity_3.gif" alt="sample" title="sample" width="270" height="480" align="right" />
AXAnimationSet
AXAnimation.create()
.duration(1000)
.toBottom(AXAnimation.MATCH_PARENT)
.nextSection()
.toLeft(0)
.nextSectionWithDelay(500)
.backToFirstPlace()
.save("v1");
AXAnimation.create()
.duration(1000)
.toTop(0)
.nextSection()
.toRight(AXAnimation.MATCH_PARENT)
.nextSectionWithDelay(500)
.backToFirstPlace()
.save("v2");
AXAnimationSet.delay(1000)
.andAnimate("v1", findViewById(R.id.view1))
.andAnimate("v2", findViewById(R.id.view2))
.start();
<img src="/images/activity_4.gif" alt="sample" title="sample" width="270" height="480" align="right" />
copyOfView(...)(PreRule)
AXAnimation.create()
.waitBefore(1000)
.duration(1000)
.toCenterOf(AXAnimation.PARENT_ID)
.scale(2f)
.nextSectionWithDelay(500)
.re
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
