Draws random flying particles in space forming constellations.

Overview

ParticlesDrawable

Draws random flying particles in space forming constellations.

Min API level 9.

Contains:

  • ParticlesDrawable, which is an Animatable Drawable.
  • ParticlesView, which is a View.

Both have the same public methods for customization and may be inflated using the same customization xml attributes.

Add to your project

Maven Central

dependencies {
    implementation 'com.github.doctoror.particlesdrawable:library:[version]'
}

Screenshots

screenshot

Usage

ParticlesDrawable usage example

private final ParticlesDrawable mDrawable = new ParticlesDrawable();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo);
    findViewById(R.id.view).setBackground(mDrawable);
}

@Override
protected void onStart() {
    super.onStart();
    mDrawable.start();
}

@Override
protected void onStop() {
    super.onStop();
    mDrawable.stop();
}

Customization

Here is a list of all attributes, set with default values

<com.doctoror.particlesdrawable.ParticlesView
    app:density="60"
    app:frameDelayMillis="10"
    app:lineColor="@android:color/white"
    app:lineLength="86dp"
    app:lineThickness="1dp"
    app:particleColor="@android:color/white"
    app:particleRadiusMax="3dp"
    app:particleRadiusMin="1dp"
    app:speedFactor="1" />

The conventional getters and setters are also available.

Since API 24, you may also customize the Drawable in xml. For example, create drawable-v24/particles_density_120.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- Some versions of Android Studio may show false warning,
"Element drawable must be declared", but it works fine when
compiling and running -->
<drawable
    class="com.doctoror.particlesdrawable.ParticlesDrawable"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:density="120"/>

And inflate, like

mDrawable = (ParticlesDrawable) ContextCompat
        .getDrawable(this, R.drawable.particles_density_120);

Configuration Demo

Particle Constellations Live Wallpaper has a great configuration screen which allows you to quickly see through what can you do with the library:

Video

License

Copyright 2017 Yaroslav Mytkalyk

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

You might also like...
Space x app fetching data from api using apollographql, databinding, navigation components and hilt for DI.
Space x app fetching data from api using apollographql, databinding, navigation components and hilt for DI.

Space-X Space-X is an android application that displays the list of launches from the Space-X API using ApolloGraphql inclusive of their launch site a

Link previews between JetBrains Space and Slack

slack-unfurls This is the application for providing link previews between Slack and Space in both directions. It provides link previews for Slack mess

>On this day< is a JetBrains Space app which shows Wikipedia-based information about what happened on that or given day
On this day is a JetBrains Space app which shows Wikipedia-based information about what happened on that or given day

kotlin-spaces-app-onthisday On this day is a JetBrains Space app which shows Wikipedia-based information about what happened on that or given day Stat

[] FFmpeg build for android random architectures with example jni

AndroidFFmpegLibrary This project aims to create working library providing playing video files in android via ffmpeg libraries. With some effort and N

[] FFmpeg build for android random architectures with example jni
[] FFmpeg build for android random architectures with example jni

AndroidFFmpegLibrary This project aims to create working library providing playing video files in android via ffmpeg libraries. With some effort and N

A smart seek bar with multiple junction points at random seek position.
A smart seek bar with multiple junction points at random seek position.

TerminalSeekBar A smart seek bar for android with multiple junction points at random seek position. Installation and Usage To use TerminalSeekBar in y

The app has got fullscreen Turkey map via Huawei Map. App selects random province and shows it borders on the map than user will try to guess the provinces name.
The app has got fullscreen Turkey map via Huawei Map. App selects random province and shows it borders on the map than user will try to guess the provinces name.

Il Bil App Introduction I will introduce you to how to implement Account Kit, Map Kit, Game Service. About the game: The app has got fullscreen Turkey

Fetch random dog images
Fetch random dog images

RandomDogImages Show Random Dog Images Demo application built in 100% Kotlin and implementing some Jetpack Components. This app was developed for as a

This is a practice app. An app that you can find random recipes and choose the ones you like.
This is a practice app. An app that you can find random recipes and choose the ones you like.

A food suggestion app like Tinder This is a practice app. In this app, you can find random recipes and choose the ones you like. This is main menu. Yo

Simple random ore mod for Minecraft/Fabric. Heavily inspired by Randomite.

Rand'Ore Download Simple random ores for Fabric! This mod is open source and under a permissive license. As such, it can be included in any modp

Jetpack Compose app which generates random names
Jetpack Compose app which generates random names

Compose-Your-Name? A Jetpack Compose App Meme App for knowing you nick name Inspiration You recently might have seen this meme on Instagram, I also di

AnimApp is an app that recommends you random anime and you can add it to your favourite if you like it.
AnimApp is an app that recommends you random anime and you can add it to your favourite if you like it.

papb-team6 AnimApp is an app that recommends you animes and you can add it to your favourite if you like it. Team members: Firdaus Bisma Suryakusuma (

An app for random Reddit memes with the option to share it as well!

Meme Share App What - An app for random Reddit memes with the option to share it as well! Why - Wanted to learn about integrating APIs with Android ap

Jetpack Compose android app that gets random footballer data from REST API. Retrofit, Dependency Injection...
Jetpack Compose android app that gets random footballer data from REST API. Retrofit, Dependency Injection...

random-footballer Jetpack Compose android app that gets random footballer data from REST API. Retrofit, Dependency Injection... Random Footballer Demo

🐶 Simple app which shows random dog image from Dog API
🐶 Simple app which shows random dog image from Dog API

🐶 Doggy App 🐶 🐾 Simple app which shows random dog image from Dog API with Retrofit2 and Glide 🐾 ❤️ Retrofit @GET Request YouTube Tutorial! (Stevdz

Simple random ore mod for Minecraft/Rift. Heavily inspired by Randomite.

Rand'Ore Download Simple random ores for Rift! This mod is open source and under a permissive license. As such, it can be included in any modpac

Just another Quotes app with beautiful UI which shows random quotes from the internet
Just another Quotes app with beautiful UI which shows random quotes from the internet

RandomQuotes Just another Quotes app with beautiful UI which shows random quotes from the internet. Screenshots Libraries Volley Android Material API

Mobile App that shows Random Products in a Nested Recyclerview for Android [Kotlin] Developer Role at Edvora
Mobile App that shows Random Products in a Nested Recyclerview for Android [Kotlin] Developer Role at Edvora

EdvoraAndroidTest An simple Android App for Edvora Android Assessment. It consum

A mix of random small libraries for Kotlin, the smallest reside here until big enough for their own repository.

klutter Random small libraries, usually extensions making other libraries happier. Versions later than 2.x are for JDK 8 and newer only. Maven Depende

Comments
  • QUESTION: Stop ParticlesView?

    QUESTION: Stop ParticlesView?

    Thanks for the amazing library! I am using it in conjunction with SlidingRootNav for some amazing effects: https://github.com/yarolegovich/SlidingRootNav/issues/10

    There exists methods to stop Particles Drawable. However, no method exists for stopping ParticlesView. I have experimented a bit and discovered that if the view is hidden, CPU usage is greatly decreased. However, it appears that the particles are still being calculated?

    A quick hack I have found is to set the number of particles to 0 when the view is hidden so no particles are being calculated. Is that the best way to keep the particles from consuming resources?

    enhancement 
    opened by searchy2 3
  • ParticleView Preview Error Since v1.0.5

    ParticleView Preview Error Since v1.0.5

    ParticleView had a really nice preview that displayed the generated particles in v1.0.4 and below. There are changes made in v1.0.5 that now cause an error in Android Studio preview. This is the stack trace of the error:

    java.lang.VerifyError: Expecting a stackmap frame at branch target 20
    Exception Details:
      Location:
        com/doctoror/particlesdrawable/ParticlesView.init(Landroid/content/Context;Landroid/util/AttributeSet;)V @5: if_icmplt
      Reason:
        Expected stackmap frame at this location.
    

    Could the switch to SceneController from Particles Drawable in commit 5afb9214d96edacfcb4981260a99222b4457b8cc be the cause?

    The preview feature is not that important but it was nice to have the preview working and would be nice to have it back again.

    Preview v1.0.4 and below: particle view 1 4

    Preview v1.0.5 and above: particle view 1 7

    bug 
    opened by searchy2 1
  • Background color

    Background color

    How could i change the color of the background? I don't know why, but the background it's almost white in my project. Thank you.

    Edit: finally i did It, sorry :P

    opened by AVR185 0
  • ERROR: Failed to resolve: library

    ERROR: Failed to resolve: library

    Hi,

    I'm trying to use it with gradle: implementation 'com.github.doctoror.particlesdrawable:library:2.0.0'

    But I get the error "ERROR: Failed to resolve: library". When I use 1.0.9 it works just fine.

    opened by skipper570 2
Owner
Yaroslav Mytkalyk
Android Software Engineer
Yaroslav Mytkalyk
How-Many-People-Are-In-Space - Do you wonder how many people are in space? Now you can check instantly with this app

How Many People Are In Space? Do you wonder how many people are in space right n

null 2 May 10, 2022
Awesome Kid's Drawing App. It has a click and draws feature.

CanvaKids Overview It's a kid's drawing app which is build for android users. It is built in Kotlin with some very good practices involved.

null 9 Oct 30, 2021
Simple custom view that draws an n-point star for Android

StarView ?? Simple custom view that draws an n-point star for Android. Features

Paul T 9 Dec 21, 2022
A Lightweight PDF Viewer Android library which only occupies around 125kb while most of the Pdf viewer occupies up to 16MB space.

Pdf Viewer For Android A Simple PDF Viewer library which only occupies around 125kb while most of the Pdf viewer occupies upto 16MB space. How to inte

Rajat 362 Dec 29, 2022
Space Navigation is a library allowing easily integrate fully customizable Google Spaces like navigation to your app.

Space-Navigation-View Introduction Space Navigation is a library allowing easily integrate fully customizable Google [Spaces][1] like navigation to yo

Arman 2k Dec 23, 2022
Linear layout, that wrap its content to the next line if there is no space in the current line.

Android flow layout Introduction Extended linear layout that wrap its content when there is no place in the current line. [] (https://travis-ci.org/Ap

Artem.Votincev 2k Jan 5, 2023
Simple space game, built with Compose for Desktop!

Asteroids, built with Compose for Desktop Want to learn how I built it? Read the two-part article in which I describe the most interesting parts of th

Sebastian Aigner 69 Nov 28, 2022
Space recommendation system and augmenting informations with ARCore SDK

Space recommendation system and augmenting informations with ARCore SDK

PNU-Sinbaram 4 Sep 3, 2021
An app to reserve office space

Booking App This app is built to demonstrate the modern design of an Android application About We load Rooms data from API and store it in a Room data

null 1 Nov 19, 2021
Simple Keyboard can adjustable keyboard height for more screen space

Simple Keyboard About Features: Small size (<1MB) Adjustable keyboard height for more screen space Number row Swipe space to move pointer Delete swipe

Raimondas Rimkus 681 Dec 27, 2022