xandone/ParabolaBlast


自定义View抛物线爆炸效果

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

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

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.xandone:ParabolaBlast:0.1'
	}
	dependencies {
		implementation("com.github.xandone:ParabolaBlast:0.1")
	}
	<dependency>
	    <groupId>com.github.xandone</groupId>
	    <artifactId>ParabolaBlast</artifactId>
	    <version>0.1</version>
	</dependency>

                            
    libraryDependencies += "com.github.xandone" % "ParabolaBlast" % "0.1"
        
        

                            
    :dependencies [[com.github.xandone/ParabolaBlast "0.1"]]
        
        

Readme


ParabolaBlast

抛物线爆炸小球

1.效果图(gif):

2.用法简介:

传入ParabolaView终点坐标(x,y),执行动画startAnim(x,y)</br> 当前Activity必须实现ParabolaView中的AnimEndInterface接口(已改)</br> Activity实现AnimEndInterface太过于局限,更改成聚合的设计模式,适用于Activity/ViewGroup/Dialog等..

2.栗子:

设置OnTouchListener事件,将手指点击处作为终点坐标(x,y)传入,开启动画效果。

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_UP) {
            parabolaView.startAnim((int) event.getX(), (int) event.getY());
        }
        return true;
    }

重写:

 @Override
    public void onDrawBall(List<LittleBall> littleBalls) {
        boomView.startAnim(littleBalls);
    }