package com.cvte.demo.mesh;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.util.Log;
/*add by liyun 20150327 add InhaleRightMesh*/
public class InhaleRightMesh extends Mesh {
private Path mRightFirstPath;
private Path mRightSecondPath;
private PathMeasure mRightFirstPathMeasure;
private PathMeasure mRightSecondPathMeasure;
public InhaleRightMesh(int width, int height) {
super(width, height);
mRightFirstPath = new Path();
mRightSecondPath = new Path();
mRightFirstPathMeasure = new PathMeasure();
mRightSecondPathMeasure = new PathMeasure();
}
@Override
public void buildPaths(float endX, float endY) {
if (mBmpWidth <= 0 || mBmpHeight <= 0) {
throw new IllegalArgumentException(
"Bitmap size must be > 0, did you call setBitmapSize(int, int) method?");
}
mRightFirstPathMeasure.setPath(mRightFirstPath, false);
mRightSecondPathMeasure.setPath(mRightSecondPath, false);
float w = mBmpWidth;
float h = mBmpHeight;
mRightFirstPath.reset();
mRightSecondPath.reset();
mRightFirstPath.moveTo(w, h/2-10);
mRightSecondPath.moveTo(w, h/2+10);
mRightFirstPath.quadTo((7*endX) / 4, 10, (3*endX)/2, 5);
mRightSecondPath.quadTo((7*endX) / 4, h-10, (3*endX)/2, h-5);
mRightFirstPath.quadTo((5*endX) / 4, 10, endX, endY-4);
mRightSecondPath.quadTo((5*endX) / 4, h-10, endX, endY+4);
}
@Override
public void buildMeshes(int timeIndex) {
if (mBmpWidth <= 0 || mBmpHeight <= 0) {
throw new IllegalArgumentException(
"Bitmap size must be > 0, did you call setBitmapSize(int, int) method?");
}
mRightFirstPathMeasure.setPath(mRightFirstPath, false);
mRightSecondPathMeasure.setPath(mRightSecondPath, false);
int index = 0;
float[] pos1 = {0.0f, 0.0f};
float[] pos2 = {0.0f, 0.0f};
float firstLen = mRightFirstPathMeasure.getLength();
float secondLen = mRightSecondPathMeasure.getLength();
float len1 = firstLen / mHorizontalSplit;
float len2 = secondLen / mHorizontalSplit;
float firstPointDist = timeIndex * len1;
float secondPointDist = timeIndex * len2;
float firstDist = firstLen;
float firstSplitDist = firstDist / mHorizontalSplit;
float secondDist = secondLen;
float secondSplitDist = secondDist / mHorizontalSplit;
for (int x = 0; x <= mHorizontalSplit ; x++) {
mRightFirstPathMeasure.getPosTan(x * firstSplitDist + firstPointDist, pos1, null);
mRightSecondPathMeasure.getPosTan(x * secondSplitDist + secondPointDist, pos2, null);
float fx1 = pos1[0];
float fx2 = pos2[0];
float fy1 = pos1[1];
float fy2 = pos2[1];
float dy = fy2 - fy1;
float dx = fx2 - fx1;
for (int y = 0; y <= mVerticalSplit; y++) {
float fx = dx * y / mVerticalSplit;
float fy = dy * y / mVerticalSplit;
mVertices[index * 2 + 0] = fx + fx1;
mVertices[index * 2 + 1] = fy + fy1;
index += 1;
}
}
}
public Path[] getPaths() {
return new Path[]{mRightFirstPath, mRightSecondPath};
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
实现Viewpager切换界面导航栏水波纹动画效果
共53个文件
class:17个
png:10个
xml:8个
3星 · 超过75%的资源 需积分: 34 17 下载量 150 浏览量
2015-03-27
17:19:24
上传
评论 1
收藏 1.49MB ZIP 举报
温馨提示
防百度阅读标题栏水波纹效果 动画 实现Viewpager切换界面导航栏水波纹动画效果
资源推荐
资源详情
资源评论
收起资源包目录
TestMesh.zip (53个子文件)
InhaleAnimation
.project 844B
project.properties 563B
src
com
cvte
demo
mesh
InhaleMesh.java 3KB
RightMesh.java 2KB
Mesh.java 2KB
LeftMesh.java 2KB
InhaleRightMesh.java 3KB
TestMesh.java 3KB
AndroidManifest.xml 695B
res
drawable-ldpi
drawable-hdpi
ic_launcher.png 8KB
bt_animator_main.png 386B
drawable-mdpi
ic_launcher.png 4KB
layout
view2.xml 419B
test_main.xml 1019B
view1.xml 427B
drawable-xhdpi
ic_launcher.png 12KB
values
strings.xml 218B
styles.xml 197B
dimens.xml 216B
.settings
org.eclipse.jdt.core.prefs 177B
assets
gen
com
cvte
demo
BuildConfig.java 155B
R.java 2KB
libs
android-support-v4.jar 543KB
.classpath 475B
bin
resources.ap_ 126KB
classes
com
cvte
demo
R$layout.class 442B
R$style.class 380B
R$dimen.class 446B
BuildConfig.class 335B
R$drawable.class 501B
R$attr.class 325B
R$id.class 435B
mesh
LeftMesh.class 3KB
TestMesh$1.class 1KB
TestMesh$MyAdapter.class 2KB
InhaleRightMesh.class 3KB
TestMesh.class 2KB
InhaleMesh.class 3KB
RightMesh.class 3KB
Mesh.class 2KB
R.class 582B
R$string.class 457B
TestMesh.apk 341KB
AndroidManifest.xml 695B
dexedLibs
android-support-v4-6e92ac8621cfcbf75ac98aae0df0c328.jar 206KB
jarlist.cache 120B
res
crunch
drawable-hdpi
ic_launcher.png 6KB
bt_animator_main.png 390B
drawable-mdpi
ic_launcher.png 3KB
screenshot1.png 51KB
screenshot.png 51KB
drawable-xhdpi
ic_launcher.png 9KB
classes.dex 620KB
共 53 条
- 1
资源评论
- minchai2016-09-13咩有用,浪费Nowindyli2016-12-16http://download.csdn.net/detail/ahjxly/8596575... csdn没法删之前写的。。容易搞错。。
- zazazazaza2015-11-28程序可以运行,但不是我要的ViewPager切换效果Nowindyli2016-12-16http://download.csdn.net/detail/ahjxly/8596575... csdn没法删之前写的。。容易搞错。。可以看下
- liwu1989232015-09-21请问运行后前后的图片都变形了需要怎么调试Nowindyli2016-11-22根据需要调整中间的算法比例。
Nowindyli
- 粉丝: 27
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功