玩过 Path 的朋友一定会被其主页的功能按钮动画所吸引,觉得很神奇。
废话不多说,直接贴代码, 完整代码请下载。
附源码
private static void startAnimationsIn(ViewGroup viewgroup)
{
int count = viewgroup.getChildCount();
for(int i=0; i<count; i++){
if(viewgroup.getChildAt(i) instanceof InOutImageButton)
{
InOutImageButton imgView = (InOutImageButton)viewgroup.getChildAt(i);
ComposerButtonAnimation animation = new ComposerButtonAnimation(InOutAnimation.Direction.IN, 200, imgView);
long startOffset = i * 100 / (count -1);
animation.setStartOffset(startOffset);
animation.setInterpolator(new OvershootInterpolator(2F));
imgView.startAnimation(animation);
}
}
}
private static void startAnimationsOut(ViewGroup viewgroup)
{
int count = viewgroup.getChildCount();
for(int i=0; i<count; i++){
if(viewgroup.getChildAt(i) instanceof InOutImageButton)
{
InOutImageButton inoutimagebutton = (InOutImageButton)viewgroup.getChildAt(i);
int direction = InOutAnimation.Direction.OUT;
ComposerButtonAnimation anim = new ComposerButtonAnimation(direction, 200, inoutimagebutton);
long startOffset = (count -1 - i) * 100 / (count -1);
anim.setStartOffset(startOffset);
anim.setInterpolator(new AnticipateInterpolator(2F));
inoutimagebutton.startAnimation(anim);
}
}
}
protected void addInAnimation(View aview[])
{
ViewGroup.MarginLayoutParams marginlayoutparams = (ViewGroup.MarginLayoutParams)aview[0].getLayoutParams();
float fromX = -marginlayoutparams.leftMargin + xOffset;
float fromY = marginlayoutparams.bottomMargin - 13;
TranslateAnimation anim = new TranslateAnimation(fromX, 0F, fromY, 0F);
addAnimation(anim);
}
protected void addOutAnimation(View aview[])
{
android.view.ViewGroup.MarginLayoutParams marginlayoutparams = (android.view.ViewGroup.MarginLayoutParams)aview[0].getLayoutParams();
float toX = -marginlayoutparams.leftMargin + xOffset;
float toY = marginlayoutparams.bottomMargin - 13;
TranslateAnimation anim = new TranslateAnimation(0F, toX, 0F, toY);
addAnimation(anim);
}
- 大小: 18.5 KB
分享到:
相关推荐
Android Path轨迹动画事列, 精美页面展示案列,仿照国外Path应用 时间轴精美页面
Android 代码,实现path2.0 炫酷的旋转菜单效果,点击主按钮 会在按钮周围弹出一系列小按钮,点击小按钮 所有小按钮 缩回到主按钮位置,动画效果非常绚丽.
ANDROID 仿path按钮效果(无旋转),效果还可以,旋转好像比较复杂,,
android path 画折线(目前没有动画,有时间后续会加上)
android-pathview路径动画库.rar,太多无法一一验证是否可用,程序如果跑不起来需要自调,部分代码功能进行参考学习。
android仿 path 应用上左下角按钮的动画效果 运用了 多种动画 组合而成 超酷的动画效果 , 例子可直接运行, 比较综合
PathButton是仿Path按钮动画效果的实例,项目如图:
仿照path应用的按钮动画弹出选项的效果
android,移动开发,源码,包括path的经典动画,还有一个多方向抽屉似的控件,iamgeview原地旋转,可控制时间的旋转,直接解压运行
android 仿path动画菜单lib源码.rar
自定义pathbutton 实现菜单动画效果
用于做Path动画的自定义View。 I have a path.I have a view. (Oh~),Path(Anim)View. 现已经找到图片->SVG->PATH的正确姿势, Now i have a pic.I have a view. Oh~,Path(Anim)View. 相关博文: 实现详解: ...
矢量动画Demo 涉及android 矢量动画 path pathData path.java
anim_duration:小球一次动画时长 physic_mode : 开启物理效果(下落加速上升减速) random_color: 开启小球颜色随机 random_radius: 开启小球大小随机(在基础大小上下浮动) random_path: 开启小球路径随机(在基础...
此为AS工程文件,配套我的博客源代码,讲了用Android属性动画简单的实现Path2.0中的菜单效果,非常简单。
主要介绍了Android 使用 Path 实现搜索动态加载动画效果,本文通过图文并茂的形式给大家介绍的非常详细,需要的朋友可以参考下
好容易找到的 仿苹果左下角那个半圆的 能弹出的半圆的 动画菜单 希望大家喜欢
仿Path的商店弹出动画,不知道效果的可以先看看Path的商店模块
动手之前觉得这个效果很难,动画效果太丰富,对于文字的弯曲弹回效果几乎是束手无策,后来经过同事的点拨,有了一个大概的方向。并最终实现了先看一个大概的效果图 1 至于怎么去实现文字弯曲的效果,我之前想过...