GithubHelp home page GithubHelp logo

jleaney / chartweener Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mdechatech/chartweener

0.0 0.0 0.0 1.66 MB

Unity3D - DOTween extensions for tweening TextMeshPro characters

C# 100.00%

chartweener's Introduction

CharTweener

Got DOTween? Got TextMeshPro?

Using CharTweener, you can do stuff like this... Example

Using code like this! (Full script here)

private void Start()
{
    // Set text
    var text = GetComponent<TMP_Text>();
    text.text = "DETERMINATION";

    var tweener = text.GetCharTweener();    
    for (var i = 0; i < tweener.CharacterCount; ++i)
    {
        // Move characters in a circle
        var circleTween = tweener.DOCircle(i, 0.05f, 0.5f)
            .SetEase(Ease.Linear)
            .SetLoops(-1, LoopType.Restart);

        // Oscillate character color between yellow and white
        var colorTween = tweener.DOColor(i, Color.yellow, 0.5f)
            .SetLoops(-1, LoopType.Yoyo);

        // Offset animations based on character index in string
        var timeOffset = Mathf.Lerp(0, 1, i / (float)(tweener.CharacterCount - 1));
        circleTween.fullPosition = timeOffset;
        colorTween.fullPosition = timeOffset;
    }
}

Features

  • Tween position, rotation, scale, and color. Includes the special transform extensions like DOPunch, DOShake
  • Controlled like normal tweens. Kill, SetDelay, SetLoops, etc. work. Sequences work.
  • If you tween a character at an index that doesn't exist, the tween still happens. For example, you could oscillate the first 100 characters of an empty input field and the animation will happen as the user types in characters.

Limitations

  • Performance overhead; my laptop dips below 60FPS when tweening 3000 characters.
  • Doesn't work with per-material properties such as Outline, Glow, Underlay.
  • Only works once Start is called; you cannot tween characters in the same frame that the TextMeshPro component is enabled for the first time!

Installation

  • Have DOTween and TextMeshPro installed in your project.
  • Get the .unitypackage from the latest release.
  • Open and import, uncheck the Examples folder if needed.
  • Go crazy!

Example

script

chartweener's People

Contributors

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