• Stars
    star
    671
  • Rank 67,266 (Top 2 %)
  • Language
    Kotlin
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎨 An Android library to create gradient animation like Instagram&Spotify

Spark

Build Status Download

Create gradient animations like Instagram&Spotify.

Screenshots

screenshot

Usage

private lateinit var _spark: Spark

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    _spark = Spark(frameLayout, Spark.ANIM_GREEN_PURPLE, 4000)
    _spark.startAnimation()
}

override fun onDestroy() {
    super.onDestroy()

    _spark.stopAnimation()
}

Installation

Gradle

dependencies {
    implementation 'io.github.tonnyl:spark:x.y.z'
}

Maven

<dependency>
  <groupId>io.github.tonnyl</groupId>
  <artifactId>spark</artifactId>
  <version>x.y.z</version>
  <type>pom</type>
</dependency>

Custom Gradient Colors

Spark has 3 built-in animation-lists, and you can custom your owns.

Create gradient drawables

purple_drawable.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <gradient
        android:centerColor="#e459aa"
        android:endColor="#cd7be6"
        android:startColor="#f14589"
        android:type="linear" />

    <corners android:radius="0dp" />

</shape>

yellow_drawable.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <gradient
        android:centerColor="#F4A37B"
        android:endColor="#F08875"
        android:startColor="#F9CB87"
        android:type="linear"/>

    <corners android:radius="0dp" />

</shape>

Create the Animation List

custom_anim_list.xml

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">

    <item
        android:drawable="@drawable/yellow_drawable"
        android:duration="4500" />

    <item
        android:drawable="@drawable/purple_drawable"
        android:duration="4500" />

</animation-list>

Apply Your Custom Animation List

_spark = Spark(
    frameLayout,
    R.drawable.your_custom_anim_list, // Your custom animation
    4000
)

Thanks

Designed by Alexander Zaytsev.

Sketch Gradients

License

Spark is under the MIT license. See the LICENSE for more information.

More Repositories

1

Awesome_APIs

:octocat: A collection of APIs
11,690
star
2

PaperPlane

📚 PaperPlane - An Android reading app, including articles from Zhihu Daily, Guokr Handpick and Douban Moment.
Kotlin
1,140
star
3

Espresso

🚚 Espresso is an express delivery tracking app designed with Material Design style, built on MVP(Model-View-Presenter) architecture with RxJava2, Retrofit2, Realm database and ZXing
Java
1,087
star
4

Mango

🏀 An Android app for dribbble.com
Kotlin
655
star
5

Light

🍭 The usual Snackbar, but elegant
Kotlin
547
star
6

WhatsNew

🎉 WhatsNew automatically displays a short description of the new features when users update your app
Kotlin
475
star
7

Charles

[WIP]✨ Charles is a local multi-media selector for Android
Kotlin
429
star
8

FanfouHandpick

📖 A Fanfou Handpick Client Developed by Kotlin
Kotlin
227
star
9

Zhihu_Zhuanlan_APIs

知乎专栏API分析
190
star
10

Windary

🎓 My solutions to LeetCode problems written in Go, Java, JavaScript, Kotlin, Python, Rust & Swift.
Swift
189
star
11

Translator

📘 Translator-A translation app based on Android platform
Java
67
star
12

Reader

📚 MVP + Volley + Gson, 内容包含了糗事百科,煎蛋,和内涵段子
Java
58
star
13

Latticify

[DEPRECATED]💬 An Android app for Slack.
Kotlin
42
star
14

awesome-courses-of-chinese-university

中国大学课程资料
30
star
15

GaussianBlur

Android Gaussian Blur using RenderScript
Java
26
star
16

wukong

A command-line tool for browsing GitHub trending written by Rust. [DEPRECATED]
Rust
24
star
17

Packman

A mobile application made for managing GitLab CI/CD jobs, demonstrating how to implement some latest technologies in mobile software development.
Kotlin
16
star
18

Dash

Design patterns in Kotlin and Swift.
Swift
12
star
19

Telecode

Country&Region&Telecode data in Chinese&English
11
star
20

CircleProgressBar

A circel progress bar library on Android
Java
6
star
21

WaterPal

🥛 WaterPal - Remind you to drink water at regular time.
Java
5
star
22

toolman

A collection of tools
Shell
5
star
23

Moka-Feedback

Moka is a mobile app for GitHub.
4
star
24

cathem

Dart
4
star
25

MyPythonLearnProject

My Project of Learning Python
Python
3
star
26

TDate

Calculate the date in a way that is similar to Windows system
C++
2
star
27

TonnyL

1
star
28

ActionsFlow

1
star