Glass-break effect for views

Related tags

UI/UX BrokenView
Overview

BrokenView

Glass-break effect for views.

brokenview

Demo

Download APK

Usage

Android Studio

dependencies {
   compile 'com.zys:brokenview:1.0.3'
}

Eclipse

Just put brokenview.jar into the libs folder of your app.

Basic Example

brokenView = BrokenView.add2Window(context);
listener = new BrokenTouchListener.Builder(brokenView).build();
view.setOnTouchListener(listener);

More Config

Use BrokenTouchListener.Builder for more configurations, and set custom attributes as shown below:

BrokenTouchListener.Builder(brokenView).

    setComplexity(...).          // default 12 
    
    setBreakDuration(...).       // in milliseconds, default 700ms
    
    setFallDuration(...).        // in milliseconds, default 2000ms
    
    setCircleRiftsRadius(...).   // in dp, default 66dp, you can disable circle-rifts effect by set it to 0
    
    setEnableArea(...).          // set the region or childview that can enable break effect,
                                 // be sure the childView or childView in region doesn't intercept any touch event
                                 
    setPaint(...).               // the paint to draw rifts
    
    build();

You can also set a callback to listen to the status of animations, like this:

brokenView.setCallback.(new BrokenCallback() {

   @Override
   public void onStart(View v) {...}
   
   @Override
   public void onCancel(View v) {...}
   
   @Override
   public void onCancelEnd(View v) {...}
   
   @Override
   public void onRestart(View v) {...}
   
   @Override
   public void onFalling(View v) {...}
   
   @Override
   public void onFallingEnd(View v) {...}
});

Compatibility

  • Support API LEVEL >= 14

Changelog

Version 1.0.0
  • First release

Version 1.0.1

  • Optimize animation effects
  • Set minSdkVersion to 14

Version 1.0.2

  • Added many annotations
  • Added new features: setCircleRiftsRadius, setEnableArea

Version 1.0.3

  • Fixed ANR caused by setCircleRiftsRadius(0)
  • Better annotations

License

BrokenView is available under the MIT license.

You might also like...
Squishy button effect with kotlin
Squishy button effect with kotlin

Squishy Usage Add squishy() modifier on your composable element. Text( text = "Squishhhhyyyyy", modifier = Modifier .size(200.dp, 100.dp

JetCompose - Blur Effect in Android 12 with motion layout carousel
JetCompose - Blur Effect in Android 12 with motion layout carousel

JetCompose Blur Effect in Android 12 with motion layout carousel

Android layout decorators : Injecting custom attributes in layout files, Using decorators to get rid of unnecessary class explosion with custom views
Android layout decorators : Injecting custom attributes in layout files, Using decorators to get rid of unnecessary class explosion with custom views

Decor Decor is a library that applies decorators to Android layout with additional attributes without the need to extend and create a custom View for

ScratchView 7.0 0.0 L4 Java  repo is UX Design involving scratch cards like views which are scratched to reveal the information they conceal.
ScratchView 7.0 0.0 L4 Java repo is UX Design involving scratch cards like views which are scratched to reveal the information they conceal.

ScratchView Intro ScratchView repo is UX Design involving scratch cards like views which are scratched to reveal the information they conceal. There a

A small, easy to use android library for implementing flipping between views as seen in the popular Flipboard application

FlipView About This library is made to be very easy to use and at the same time be feature complete. With only a few lines of code you can have a flip

This is a library to help creating expanding views with animation in Android
This is a library to help creating expanding views with animation in Android

About the Library inspiration This library is strongly inspired in this concept from Hila Peleg in dribble. See it below Working example For more deta

An Android library introducing a stack of Views with the first item being flippable.
An Android library introducing a stack of Views with the first item being flippable.

FlippableStackView An Android library introducing a stack of Views with the first item being flippable. Views inside the stack remain the aspect ratio

💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. 💳 EasyFlipView Built with ❤︎ by Wajahat Karim and

ScratchView repo is UX Design involving scratch cards like views which are scratched to reveal the information they conceal.
ScratchView repo is UX Design involving scratch cards like views which are scratched to reveal the information they conceal.

ScratchView Intro ScratchView repo is UX Design involving scratch cards like views which are scratched to reveal the information they conceal. There a

Comments
  • 请问下,如何让自动指定位置破碎

    请问下,如何让自动指定位置破碎

    public void animationBroken(View mView){ BrokenConfig mBrokenConfig=new BrokenConfig(); mBrokenConfig.complexity=8; Point mPaint=new Point(parentLayout.getWidth()/2,parentLayout.getHeight()/2); BrokenAnimator mBrokenAnimator=mBrokenView.createAnimator(parentLayout,mPaint,mBrokenConfig); mBrokenAnimator.start();

    }
    

    有时候破碎不成功

    opened by chongbo2013 4
  • BrokenView with ViewPager

    BrokenView with ViewPager

    I've implemented BrokenView with ViewPager, and it is only working for the first Tab (View) that references it in the ViewPager - any ideas why?

    Many thanks

    opened by plthatfunkymusic 0
  • Falling animation repeats

    Falling animation repeats

    When glass gets breaked it apears once again and falls again :-X I am adding view with default listener

    
    	RelativeLayout relative = (RelativeLayout) getLayoutInflater().inflate(R.layout.view_break_glass, null);
    
    	ImageView imageView = (ImageView) relative.findViewById(R.id.glass);
    
    	BrokenView brokenView = BrokenView.add2Window(this);
    
    	BrokenTouchListener listener = new BrokenTouchListener.Builder(brokenView).build();
    
    	imageView.setOnTouchListener(listener);
    
    	return relative;
    
    opened by YuckFo 5
Owner
we all have a bright future
null
A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Dionysis Lorentzos 2.3k Dec 9, 2022
Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.

Android StackBlur Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. Th

Enrique López Mañas 3.6k Dec 29, 2022
Android ImageViews animated by Ken Burns Effect

KenBurnsView Android library that provides an extension to ImageView that creates an immersive experience by animating its drawable using the Ken Burn

Flávio Faria 2.7k Dec 23, 2022
View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)

RippleView View that imitates Ripple Effect on click which was introduced in Android L. Usage For a working implementation, Have a look at the Sample

Muthuramakrishnan Viswanathan 1.2k Dec 30, 2022
A TagView library for Android. Customize your own & Drag effect.

AndroidTagView An Android TagView library. You can customize awesome TagView by using this library. Screenshots Usage Step 1 Add below dependency in y

lujun 1.7k Dec 29, 2022
Pop animation with circular dust effect for any view updation

Popview-Android Pop animation with circular dust effect for any view updation Getting Started In your build.gradle dependencies { compile 'rb.popv

R B Krishna 489 Dec 28, 2022
An Index Side Bar With Wave Effect

WaveSideBar You can use WaveSideBar in the contacts page of your application. Refer to AlexLiuSheng/AnimSideBar. Screenshot Include the WaveSideBar to

郭佳哲 1.3k Dec 12, 2022
This is a android custom view , like a scratch card effect!

ScratchView This is a android custom view , like a scratch card effect! Last Update 采纳DearZack童鞋的优化思路,把计算擦除面积比例的操作放在手指离开屏幕时,以降低对CPU的占用。 Articles Scrat

D_clock爱吃葱花 316 Nov 29, 2022
This is a picker view for android , support linkage effect, timepicker and optionspicker.(时间选择器、省市区三级联动)

Android-PickerView English Document 注意事项、详请使用方式、更新日志等,请查看 Wiki文档 Wiki文档,Wiki文档,Wiki文档 !~ 重要的事情说三遍 对于使用上有任何疑问或优化建议等,欢迎加入QQ群讨论交流技术问题。 交流群1: 387051294(推荐

Bigkoo 13.2k Jan 6, 2023
Simple and fantastic wheel view in realistic effect for android.

Overview ![Size](https://img.shields.io/badge/Size-17 KB-e91e63.svg) Contact Preview Demo WheelPicke.APK Include Compile compile 'cn.aigestudio.wheelp

Aige 2.5k Jan 6, 2023