Giter Site home page Giter Site logo

cosin's Introduction

Build Quality Gate Status

COSIN

Loading HMOS view lib

Source

This library is inspired by the Cosin library version 1.1.0

Dependency

  1. For using Cosin module in sample app, include the source code and add the below dependencies in entry/build.gradle to generate hap/cosin.har.
dependencies {
    implementation project(':cosin')
    implementation fileTree(dir: 'libs', include: ['*.har'])
    testCompile 'junit:junit:4.12'
}
  1. For using Cosin in separate application using har file, add the har file in the entry/libs folder and add the dependencies in entry/build.gradle file.
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.har'])
    testCompile 'junit:junit:4.12'
}
  1. For using Cosin from a remote repository in separate application, add the below dependencies in entry/build.gradle file.
dependencies {
    implementation 'dev.applibgroup:cosin:1.0.0'
    testCompile 'junit:junit:4.12'
}

Features

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

Usage

Declaration

<com.nikitagordia.cosin.Cosin
        ohos:height="130vp"
        ohos:width="270px" />

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)

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.getValue();
    }

    @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

applibengineering avatar samuel-abhishek avatar yashrajgupta avatar

Stargazers

 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.