GithubHelp home page GithubHelp logo

morristech / cosin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nikitagordia/cosin

0.0 1.0 0.0 3.14 MB

Android loading view library ๐Ÿ“Š๐Ÿญ

License: MIT License

Java 100.00%

cosin's Introduction

COSIN

Loading android view lib

Gradle :

build.gradle (Project)

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

build.gradle (Module)

implementation 'com.github.NikitaGordia:Cosin:1.1.0'

Quick start guide

Declaration

<com.nikitagordia.cosin.Cosin
        android:layout_width="170dp"
        android:layout_height="140dp" />

Properties

Property Description
speed Angle speed
isLoading If 'true' shows symbols on rectangle
setEnd Shows end animation (optionally you may pass onEnd(OnEnd))
rectWidth Width each of rectangle
period Determine period of cosinusoidal function
colorAdapter Define color changes by two parameters (position count, height percent) for each rectagle
offset Moving bottom offset
directionRight Determine movement side
textAdapter Define text changes by position count for each rectangle

There are 6 default ColorAdapter implementation in box :

  • DefaultColorAdapterGB (Green -> Blue)
  • ColorAdapterBG (Blue -> Green)
  • ColorAdapterBR (Blue -> Red)
  • ColorAdapterGR (Green -> Blue)
  • ColorAdapterRB (Red -> Blue)
  • ColorAdapterRG (Red -> Green)
  • ColorAdapterBG (Blue -> Green)

There are 2 default TextAdapter implementation in box :

  • DefaultBinaryTextAdapter (shows random [0, 1] symbols in each rectagle)
  • WordTextAdapter (shows specified cycle String)

ColorAdapter overriding example :

public class ColorAdapterBR implements Cosin.ColorAdapter {

    @Override
    public int getBackgroundColor() {
        return Color.TRANSPARENT;
    }

    @Override
    public int calcColor(int numOfRect, double percentOfHeight) {
        return Color.argb(150, (int)(255 * (1d - percentOfHeight)), 0, (int)(255 * percentOfHeight));
    }
}

TextAdapter overriding example :

public class WordTextAdapter implements Cosin.TextAdapter {

    private String word;

    public WordTextAdapter(String word) {
        this.word = word;
    }

    @Override
    public char getString(int numOfRect) {
        if (word.isEmpty()) return ' ';
        return word.charAt(numOfRect % word.length());
    }
}

A bit more gifs

cosin's People

Contributors

nikitagordia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.