All Projects → irshuLx → Android-Glitch-Text-Effect

irshuLx / Android-Glitch-Text-Effect

Licence: Apache-2.0 license
An Android library to add a glitch effect into a string, inspired by https://codepen.io/ihatetomatoes/pen/8a16e11e6d6206f5eb1ed7a37fbbe1dc. Gist for this library is here: https://gist.github.com/irshuLx/138c1dc0af5262e3ca0c5f5db014d7ef

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android-Glitch-Text-Effect

Glitch-FX-Processing-Version
A Processing version of my Glitch-FX sketch with extra features
Stars: ✭ 20 (-39.39%)
Mutual labels:  glitch-effect
react-glitch-effect
React Glitch effects
Stars: ✭ 52 (+57.58%)
Mutual labels:  glitch-effect
DYText
抖音风格的字体生成器
Stars: ✭ 20 (-39.39%)
Mutual labels:  glitch-text
glitch-studio
data bending & glitch tools
Stars: ✭ 66 (+100%)
Mutual labels:  glitch-effect

Download

Android-Glitch-Text-Effect

An Android library to add a glitch effect into a string. This project was inspired by the codepen, https://codepen.io/ihatetomatoes/pen/8a16e11e6d6206f5eb1ed7a37fbbe1dc.

Demo screen below was captured at a limited 25fps

captured at 25fps    captured at 25fps

Download

gradle:

compile 'com.github.irshulx:glitch-text-effect:1.0.1'

or maven:

<dependency>
  <groupId>com.github.irshulx</groupId>
  <artifactId>glitch-text-effect</artifactId>
  <version>1.0.1</version>
  <type>pom</type>
</dependency>

A gist of this library is available at https://gist.github.com/irshuLx/138c1dc0af5262e3ca0c5f5db014d7ef

Usage

<com.github.irshulx.glitchtext.GlitchTextEffect
    android:layout_width="match_parent"
    app:text="PURGE"
    app:noise="7"
    app:textColors="@array/glitch_colors"
    app:textSize="27"
app:speed="70"
    android:layout_height="match_parent" />

or programmatically:

List<Integer> colors = new ArrayList<>();
    colors.add(R.color.colorPrimaryDark);
    colors.add(R.color.colorPink);
    colors.add(R.color.colorLightBlue);
    colors.add(R.color.colorFront);
    
    GlitchTextEffect effect = new GlitchTextEffect(this,colors,"PURGE");
    effect.setTextSize(60);
effect.setSpeed(70); //duration of a single cycle animation
    effect.setNoise(6); //the noise quotient of the effect
    effect.start();     // required to call for programmatic initiation
    layout.addView(effect);

The logic is to stack textviews on a FrameLayout and animate their positions in opposite directions. The no. of textviews added is proportional to the number of colors in the array.

enter image description here

API

void setTextSize(int size);    // set the textsize in sp

void setNoise(int level);     // set the noise level, recommended between 5-10

void setFontFile(String fileName); // set the font to be used, eg: "fonts/Poppins-Black.ttf"

void setSpeed(int speed); // speed in ms, recommends 50-200

##License

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.
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].