Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
<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.ivorcho:SnowfallView:1.0'
}
<dependency>
<groupId>com.github.ivorcho</groupId>
<artifactId>SnowfallView</artifactId>
<version>1.0</version>
</dependency>
libraryDependencies += "com.github.ivorcho" % "SnowfallView" % "1.0"
:dependencies [[com.github.ivorcho/SnowfallView "1.0"]]
This is a small library which provides a simple View that animates snowfall using any image you provide to it as a snowflake.
Simply add the following in your project build.gradle
file:
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
Add the dependency to your module build.gradle
:
dependencies {
compile 'com.github.ivorcho:SnowfallView:1.0'
}
Simply add the view to your layout. Make sure it is on top of all of your views so it is visible:
<com.ivorcho.snowfallview.SnowfallView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:snowflake="@drawable/ic_snowflake"
app:spawnRate="400"/>
You can use the following attributes for customization:
snowflake
- Reference to a drawable which to be used as a snowflake. Coresponding method: setFlakeImage()
spawnRate
- Rate in milliseconds at which the snowflakes are spawned. Coresponding method: setSnowflakeSpawnRate()