Skip to content

可以定制一些简单的路径,按想要的绘制顺序添加,SimpleLineView会依次展现路径动画。

Notifications You must be signed in to change notification settings

InterestingAndroid/SimpleLineView

 
 

Repository files navigation

SimpleLineView

介绍: http://blog.csdn.net/kobeyxd123/article/details/79346263

这里简单借鉴了OkHttp的责任链模式,整体架构图如下: image

效果图

image image

使用

Gradle

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

dependencies {
	implementation 'com.github.XingdongYu:SimpleLineView:v1.0.0'
}

Maven

<repositories>
	<repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
	</repository>
</repositories>

<dependency>
    <groupId>com.github.XingdongYu</groupId>
    <artifactId>SimpleLineView</artifactId>
    <version>v1.0.0</version>
</dependency>

添加路径

// 圆形
PixelPath circlePath = new PixelPath(10, 10, new int[]{1, 100});
CirclePainter ciclePainter = new RealCirclePainter(circlePath, 1000, -120, 360, false);
// 矩形
PixelPath squarePath = new PixelPath(2, 2, new int[]{1, 2, 4, 3});
Painter squarePainter = new SegmentPainter(squarePath, 1000, true);

mView.addPainter(ciclePainter).addPainter(squarePainter);
// 启动
mView.start();
// 停止
mView.stop();
// 继续
mView.stick();

路径点

以4 * 4的表格为例

1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16

如果path为{1, 13, 16, 4}, 则绘制的图形为依次连接1,13,16,4的矩形(是否封闭可设置对应参数)。

如果图形的形状比较复杂,可以用PS打开图片,依次获取像素点的x和y值(这里x和y值的单位可以是像素、厘米等,但是计算时要与图像大小的单位一致)。假设图像宽为w, 高为h, 则当前点的值为 w * ( y - 1) + x。

About

可以定制一些简单的路径,按想要的绘制顺序添加,SimpleLineView会依次展现路径动画。

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%