Android view inspired by http://qrohlf.com/trianglify/

Overview

Trianglify

Build Status Maven Central Android Arsenal

Android view inspired by http://qrohlf.com/trianglify/

Demo Screenshot

Usage

Add the dependency

dependencies {
    compile 'com.manolovn:trianglify:1.1.0'
}

Just add the view to your layout:

<com.manolovn.trianglify.TrianglifyView
            android:id="@+id/trianglify_view_sample"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

Cell size, variance, bleeds, color generator and point generator can be initialized from layout:

<com.manolovn.trianglify.TrianglifyView
            android:id="@+id/trianglify_view_sample"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            trianglify:cellSize="175"
            trianglify:variance="75"
            trianglify:bleedX="50"
            trianglify:bleedY="50"
            trianglify:colorGenerator="com.sample.color.MyCoolColorGenerator"
            trianglify:pointGenerator="com.sample.color.MyCoolPointGenerator"/>

or using setters (see sample for more info):

trianglifyView.getDrawable().setCellSize(175);
trianglifyView.getDrawable().setVariance(75);
trianglifyView.getDrawable().setColorGenerator(new AnyColorGenerator());
trianglifyView.getDrawable().setPointGenerator(new AnyPointGenerator());

In the sample, you can find an example of ColorGenerator and an example of how to use differents types of PointGenerator. In the component are included two: RegularPointGenerator (for a grid distribution) and CircularPointGenerator (for a concentric circles distribution).

License

Copyright 2015 Manuel Vera Nieto

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.
Comments
  • Extracted drawable out of TrianglifyView into TrianglifyDrawable

    Extracted drawable out of TrianglifyView into TrianglifyDrawable

    This allows us to use the drawable elsewhere (for instance on a Wear watch face canvas)

    Also, the Drawable is now rendered off the main thread to avoid UI jankiness.

    opened by dgmltn 1
  • Not inflating XML

    Not inflating XML

    Tried to add this to my project, but its showing me this error, once i start my app:

    Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/manolovn/colorbrewer/ColorBrewer; at com.manolovn.trianglify.generator.color.BrewerColorGenerator.(BrewerColorGenerator.java:17) at com.manolovn.trianglify.renderer.TriangleRenderer.initPaint(TriangleRenderer.java:39) at com.manolovn.trianglify.renderer.TriangleRenderer.(TriangleRenderer.java:24) at com.manolovn.trianglify.TrianglifyView.init(TrianglifyView.java:65) at com.manolovn.trianglify.TrianglifyView.(TrianglifyView.java:50) ... Caused by: java.lang.ClassNotFoundException: Didn't find class "com.manolovn.colorbrewer.ColorBrewer" on path: DexPathList[[zip file "/data/app/com.example.markus.blowout10-2/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]] ... com.manolovn.trianglify.generator.color.BrewerColorGenerator.(BrewerColorGenerator.java:17)  at com.manolovn.trianglify.renderer.TriangleRenderer.initPaint(TriangleRenderer.java:39)  at com.manolovn.trianglify.renderer.TriangleRenderer.(TriangleRenderer.java:24)  at com.manolovn.trianglify.TrianglifyView.init(TrianglifyView.java:65)  at com.manolovn.trianglify.TrianglifyView.(TrianglifyView.java:50)  ... Suppressed: java.lang.ClassNotFoundException: com.manolovn.colorbrewer.ColorBrewer at java.lang.Class.classForName(Native Method)

    ... 30 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

    Do you have any advice, maybe incompatible support libraries ?

    opened by ghost 1
  • fix the ANR : too many triangle objects in a short time

    fix the ANR : too many triangle objects in a short time

    (1). sample/Activity : put the drawing action out of onProgressChanged() (2) library/TriangleRenderer : remove the object(path) initialization out of onDraw()

    opened by songzhw 1
  • Latest trianglify library is not used in sample app

    Latest trianglify library is not used in sample app

    The sample app uses the latest jcenter release, which is not necessarily the most recent development version. The sample app should use the bleeding edge version of the library.

    opened by dgmltn 0
  • Get the TrianglifyDrawable object as bitmap

    Get the TrianglifyDrawable object as bitmap

    Is this possible to get the TrianglifyDrawable object as bitmap? I see the draw() class is overridden so I cant convert it to bitmap from Bitmap.draw(canvas)

    opened by ExploiTR 0
  • Caused by: java.lang.IllegalArgumentException: Can't triangulate less than 3 points

    Caused by: java.lang.IllegalArgumentException: Can't triangulate less than 3 points

    When I try to set color generator dynamically,

    binding.trvBg.drawable.setColorGenerator(RandomColorGenerator())
    

    app crashes with below stacktrace

    java.lang.RuntimeException: An error occurred while executing doInBackground()
            at android.os.AsyncTask$3.done(AsyncTask.java:354)
            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
            at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
            at java.util.concurrent.FutureTask.run(FutureTask.java:271)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
            at java.lang.Thread.run(Thread.java:764)
         Caused by: java.lang.IllegalArgumentException: Can't triangulate less than 3 points
            at com.manolovn.trianglify.util.Preconditions.checkArgument(Preconditions.java:25)
            at com.manolovn.trianglify.triangulator.DelaunayTriangulator.triangulate(DelaunayTriangulator.java:27)
            at com.manolovn.trianglify.TrianglifyDrawable$TriangulateAsyncTask.doInBackground(TrianglifyDrawable.java:127)
            at com.manolovn.trianglify.TrianglifyDrawable$TriangulateAsyncTask.doInBackground(TrianglifyDrawable.java:118)
    
    opened by theapache64 0
Owner
Manuel Vera
Manuel Vera
A view pager indicator view to deal with a large amount of pages.

Attention I'm not going to support this anymore. Just use a better solution, e.g. this one Indefinite-Pager-Indicator BubblePagerIndicator A view page

Bogdan Kornev 134 Aug 18, 2022
💳 Bank Card View is a simple and elegant card view with Flip animation.

Visualização de cartão bancário ?? Bank Card View é uma visualização de cartão simples e elegante com animação Flip. Versões Selecione a língua : Engl

Geovani Amaral 10 Dec 12, 2022
💳 Bank Card View is a simple and elegant card view with Flip animation.

Visualização de cartão bancário ?? Bank Card View é uma visualização de cartão simples e elegante com animação Flip. Versões Selecione a língua : Engl

Geovani Amaral 9 Aug 26, 2022
Deprecated in favour of https://developer.android.com/reference/android/support/v4/view/animation/PathInterpolatorCompat.html

Deprecated: use https://developer.android.com/reference/android/support/v4/view/animation/PathInterpolatorCompat.html instead. android-cubic-bezier-in

Codesoup 161 Jan 1, 2023
Android view with both path from constructed path or from svg.

android-pathview You want to animate svg or normal Paths?<br> Change the color, pathWidth or add svg.<br> Animate the "procentage" property to make th

Georgi Eftimov 2.9k Dec 30, 2022
An easy, flexible way to add a shimmering effect to any view in an Android app.

Shimmer for Android Shimmer is an Android library that provides an easy way to add a shimmer effect to any view in your Android app. It is useful as a

Facebook 5.1k Dec 26, 2022
A simple animated step view for Android

StepView A simple animated step view for Android. Backward and forward animations is supported. Usage Add jcenter() to repositories block in your grad

Bogdan Kornev 833 Dec 30, 2022
Animation View to Highlight particular Views 🎯 for Android

TargetView Animation View to Highlight particular Views ?? for Android, it can be Used with Views that you see important (Like CountDownTimer), And al

Anas Altair 53 Aug 7, 2021
Android animated recording view

AnimatedRecordingView Android animated recording view .中文版 Preview Gradle compile 'com.haozhang.libary:android-animated-recording-view:1.0' How to use

Hand Zhang 348 Nov 16, 2022
Android Library to create Lottie animation view dialog easily with a lot of customization

LottieDialog Android Library to create Lottie animation view dialog easily with a lot of customization Why you should use Lottie Dialog You have no li

Amr Hesham 39 Oct 7, 2022
Android Library to create Lottie animation view dialog easily with a lot of customization

Android Library to create Lottie animation view dialog easily with a lot of customization

Amr Hesham 39 Oct 7, 2022
Cute view animation collection.

Android View Animations One day, I saw an iOS library, which is a view shaker, it's very beautiful. I think Android also need one, and should be bette

代码家 12.2k Jan 1, 2023
ViewAnimator view with a lollipop style reveal effect

ViewRevealAnimator Widget ViewAnimator view with a lollipop style reveal effect. Regular animation can be set (just like the default ViewAnimator) for

Alessandro Crugnola 339 Jun 3, 2022
🌠 Transform into a different view or activity using morphing animations.

TransformationLayout ?? Transform into a different view or activity using morphing animations. Using Transformation motions of new material version. D

Jaewoong Eum 2k Jan 3, 2023
💳 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

Wajahat Karim 1.3k Dec 14, 2022
Automatically manipulates the duration of animations dependent on view count. Quicksand .. the more you struggle.

QuickSand When showing a really enchanting explanatory animation to your users, but you know that after a while it'll get tedious and would stop users

Paul Blundell 385 Sep 9, 2022
Customizable bounce animation for any view like in Clash Royale app

Bounceview-Android Customizable bounce animation for any view updation Getting Started In your build.gradle dependencies { implementation 'hari.bo

Hariprasanth S 149 Nov 18, 2022
A customised EditText view serving the purpose of taking numeric One Time Password from a user. With stunning animation, and high customizability.

PassCodeText A customised EditText view serving the purpose of taking numeric One Time Password from a user. With stunning animation, and high customi

Swapnil Tiwari 107 Nov 16, 2022
Custom-view-animated-file-downloader - Custom Views, Animations, Broadcast Receivers, Notifications

Downloader App Custom views , Drawing with Canvas, Animations (with motionlayout

null 2 Jun 24, 2022