Skip to content

Simple Android Library to add a customizable ripple effect to a layout View

Notifications You must be signed in to change notification settings

invissvenska/Pulsating-Ripple

Repository files navigation

Pulsating Ripple

API Build Status Buy Me A Coffee donate button

Screenshots

Please click the image below to enlarge.

Stroke Ripple Fill Ripple
Stroke Ripple Fill Ripple

Prerequisites

Add this in your root build.gradle file (not your module build.gradle file):

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

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
    ...
    implementation 'com.github.invissvenska:Pulsating-Ripple:VERSION'
}

Configuration

Add the PulsatingLayout to your layout and insert a View in it:

<nl.invissvenska.pulsatingripple.PulsatingLayout
    android:id="@+id/ripple"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
>

    <ImageView
        android:id="@+id/centerImage"
        android:layout_width="36dp"
        android:layout_height="36dp"
        android:layout_centerInParent="true"
        android:src="@drawable/atom_icon"/>

</nl.invissvenska.pulsatingripple.PulsatingLayout>

Usage

Start animation:

pulsatingLayout.startAnimation();

Stop animation:

pulsatingLayout.stopAnimation();

PulsatingLayout Attributes

Attributes Type Default Mandatory Description
pr_duration Integer 3000 No Time in milliseconds for one animation cycle.
pr_rippleAmount Integer 6 No Amount of ripples in the animation cycle.
pr_radius Dimension 24dp No Start radius of the ripple.
pr_scale Float 6 No Scale increment of the ripple.
pr_color Color #039191 No Color of the ripple.
pr_type Integer (strokeRipple, fillRipple) fillRipple No Makes the ripples stroke or filled.
pr_strokeWidth Dimension 2dp if (pr_type == strokeRipple) No Width of the stroke, will only be used when pr_type == strokeRipple.