StarryNight provides a piece of beautiful starry sky for you in a handy, customizable way as an Android library.
In project's build.gradle
:
allprojects {
repositories {
// other repositories...
maven { url "https://jitpack.io"}
}
}
In app's build.gradle
:
dependencies {
// other dependencies...
compile 'com.github.chihane:StarrySky:1.0.0'
}
Use StarrySky
like a regular ViewGroup
:
<chihane.starrysky.StarrySky
android:id="@+id/starrySky"
android:layout_width="match_parent"
android:layout_height="match_parent" />
That's it!
StarMaker
is the ONE who dominates the StarrySky
and creates all Star
s, decides how stars are like, how many they are and how they move.
These are things he can do:
StarMaker starMaker = StarMaker.with(context)
.seed(seed) // The random seed
.density(density) // How many stars there should be, [0f, 1f]
.baseMagnitude(baseMagnitude) // Base point of stars' luminance, [-6, 6]
.magnitudeAmplitude(magnitudeAmplitude) // How random stars' luminance will be, [0, 6]
.createGiantStar() // Red & blue giant stars will be created
.starTwinkles(); // Stars will twinkle
Then let him dominate the sky:
sky.dominateBy(starMaker);
Chihane Habana