All Projects → Chrisvin → Easyreveal

Chrisvin / Easyreveal

Licence: mit
Android Easy Reveal Library

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Easyreveal

Art
🎨 ASCII art library for Python
Stars: ✭ 1,026 (+203.55%)
Mutual labels:  library, easy
Observable
The easiest way to observe values in Swift.
Stars: ✭ 346 (+2.37%)
Mutual labels:  library, easy
Crashreporter
CrashReporter is a handy tool to capture app crashes and save them in a file.
Stars: ✭ 327 (-3.25%)
Mutual labels:  library
Sectionedslider
iOS 11 Control Center Slider
Stars: ✭ 336 (-0.59%)
Mutual labels:  library
Iterator
The Hoa\Iterator library.
Stars: ✭ 333 (-1.48%)
Mutual labels:  library
Libplist
A library to handle Apple Property List format in binary or XML
Stars: ✭ 330 (-2.37%)
Mutual labels:  library
Box Shadows.css
♓️ A cross-browser collection of CSS box-shadows
Stars: ✭ 335 (-0.89%)
Mutual labels:  library
Cordova Plugin Device
Apache Cordova Plugin device
Stars: ✭ 327 (-3.25%)
Mutual labels:  library
Ypimagepicker
📸 Instagram-like image picker & filters for iOS
Stars: ✭ 3,661 (+983.14%)
Mutual labels:  library
Shortcode
Advanced shortcode (BBCode) parser and engine for PHP
Stars: ✭ 331 (-2.07%)
Mutual labels:  library
Towel
Throw in the towel.
Stars: ✭ 333 (-1.48%)
Mutual labels:  library
Swift Ui Animation Components And Libraries
Swift UI libraries, iOS components and animations by @Ramotion
Stars: ✭ 3,455 (+922.19%)
Mutual labels:  library
Metrics Clojure
A thin façade around Coda Hale's metrics library.
Stars: ✭ 330 (-2.37%)
Mutual labels:  library
Orionpreview
🅾️ OrionPreview is a simple animation with tanslation or scale views written in Java.
Stars: ✭ 335 (-0.89%)
Mutual labels:  library
Espui
A simple web user interface library for ESP32 and ESP8266
Stars: ✭ 330 (-2.37%)
Mutual labels:  easy
Yandex Music Api
Неофициальная Python библиотека для работы с API сервиса Яндекс.Музыка
Stars: ✭ 335 (-0.89%)
Mutual labels:  library
Easyvalidation
✔️ A text and input validation library in Kotlin for Android
Stars: ✭ 328 (-2.96%)
Mutual labels:  library
Secure Storage Android
Store strings & credentials securely encrypted on your device
Stars: ✭ 333 (-1.48%)
Mutual labels:  library
Chiliphotopicker
Photo picker library for android. Let's you pick photos directly from files, or navigate to camera or gallery.
Stars: ✭ 333 (-1.48%)
Mutual labels:  library
Shiro
Apache Shiro
Stars: ✭ 3,685 (+990.24%)
Mutual labels:  library

EasyReveal

Android EasyReveal Library

License: MIT API

EasyReveal is an extensible reveal library that contains various reveal animations. (Demo apk)

Getting started

Setting up the dependency

  1. Add the JitPack repository to your root build.gradle at the end of repositories:
allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
  1. Add the EasyReveal dependency in the build.gradle:
implementation 'com.github.Chrisvin:EasyReveal:1.2'

Demo app

To run the demo project, clone the repository and run it via Android Studio. (OR) Download the latest demo apk from releases.

Usage

Add RevealLayout in layout.xml

The views that need to be revealed/hidden should be put inside the EasyReveal layouts.

<com.jem.easyreveal.layouts.EasyRevealLinearLayout
    ...
    app:clipPathProvider="star" // possible values: circular, linear, random_line, star, sweep & wave
    app:revealAnimationDuration="2000"
    app:hideAnimationDuration="1500" >

    <!-- The views to be revealed/hidden go here -->

</com.jem.easyreveal.layouts.EasyRevealLinearLayout>
<!-- Similarly for com.jem.easyreveal.layouts.EasyRevealConstraintLayout & com.jem.easyreveal.layouts.EasyRevealFrameLayout -->

Adding/Modifying programmatically

val revealLayout = EasyRevealLinearLayout(this)
// Set the ClipPathProvider that is used to clip the view for reveal animation
revealLayout.clipPathProvider = StarClipPathProvider(numberOfPoints = 6)
// Set the duration taken for reveal animation
revealLayout.revealAnimationDuration = 1500
// Set the duration taken for hide animation
revealLayout.hideAnimationDuration = 2000
// Set listener to get updates during reveal/hide animation
revealLayout.onUpdateListener = object: RevealLayout.OnUpdateListener {
    override fun onUpdate(percent: Float) {
        Toast.makeText(this@MainActivity, "Revealed percent: $percent", Toast.LENGTH_SHORT).show()
    }
}
// Start reveal animation
revealLayout.reveal()
// Start hide animation
revealLayout.hide()

Note : Dokka generated documentation on ClipPathProviders

Creating custom reveals

One of the core focuses of this library was extensibility. Creating your own reveal animation is as simple as extending ClipPathProvider and implementing the getPath() method. getPath() provides the Path for a given percent value on the provided view. The path gotten from getPath() is then used to clip the view using canvas.clipPath(path, op) (The op value is provided by the ClipPathProvider as well).

For example, A simultaneous 4 corner circular reveal animation can be achieved as follows.

class CustomClipPathProvider : ClipPathProvider() {
    override fun getPath(percent: Float, view: View): Path {
        path.rewind()
        val radius = getDistance(0f,0f,view.width.toFloat() / 2, view.height.toFloat() / 2) * (percent/100)
        path.addCircle(0f, 0f, radius, Path.Direction.CW)
        path.addCircle(view.width.toFloat(), 0f, radius, Path.Direction.CW)
        path.addCircle(0f, view.height.toFloat(), radius, Path.Direction.CW)
        path.addCircle(view.width.toFloat(), view.height.toFloat(), radius, Path.Direction.CW)
        return path
    }

    private fun getDistance(startX: Float, startY: Float, endX: Float, endY: Float): Float {
        return sqrt(((startX - endX) * (startX - endX)) + ((startY - endY) * (startY - endY)))
    }
}

API Documentation

Documentation generated using Dokka : chrisvin.github.io/EasyReveal

The End?

No, infact, EasyReveal was a library that I created since I needed (but was unable to find) an extensible library for view clipping. Hence, the true form of EasyReveal is infact a view clipping library, who's most obvious usecase is designing customizable reveal animations.

The first version of LiquidSwipe used EasyReveal as a dependency. If you like this library, you will probably love LiquidSwipe and ConcentricOnboarding.

Bugs and Feedback

For bugs, questions and discussions please use the Github Issues.

License

MIT License

Copyright (c) 2019 Jem

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].