Giter Club home page Giter Club logo

tagcloud's Introduction

Maven Central

Tag Cloud

Tag cloud as 3D sphere.

Allows to place items on the sphere to create a tag cloud.

Examples

See Demo application and examples.

Simple tag cloud

Tags placed on axis

Fancy tag cloud with particles inside

Usage

Get a dependency

Step 1. Add the MavenCentral repository to your build file. Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        mavenCentral()
    }
}

Or in settings.gradle:

pluginManagement {
    repositories {
        ...
        mavenCentral()
    }
}

Step 2. Add the dependency. Check latest version on the releases page.

dependencies {
    implementation 'io.github.oleksandrbalan:tagcloud:$version'
}

Use in Composable

The TagCloud has 2 mandatory arguments:

  • state - The state of the TagCloud, used to observe and change it's rotation.
  • content - The content lambda to register items to be shown in the TagCloud.

Inside content lambda use item or items method to register items in the TagCloud. Each method has own content lambda to specify how item is displayed. Inside item scope you could access item's coordinates to adjust appearance based on where item is currently in the tag cloud. Or you may use .tagCloudItemFade() and / or .tagCloudItemScaleDown() modifiers to use out-of-box behavior.

val labels = List(32) { "Item #$it" }

TagCloud(
    state = rememberTagCloudState(),
    modifier = Modifier.padding(64.dp)
) {
    items(labels) {
        Text(
            text = it,
            modifier = Modifier
                .tagCloudItemFade()
                .tagCloudItemScaleDown()
        )
    }
}

See Demo application and examples for more usage examples.

TODO list

  • Compose for desktop support
  • Add ability to focus an item
  • Add content padding for the TagCloud to expand gesture area
  • Add fling support
  • Add animateTo / animateBy methods to the TagCloudState
  • Add ability to change where item is facing
  • Fix item clipping when scale is greater than 1

tagcloud's People

Contributors

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