Git Product home page Git Product logo

animate's Introduction

Small plugin adding animation tool.

How to install

  1. Open Package Manager at Unity project.
  2. Click on “plus” at left up corner.
  3. Choose “Add package from git URL…”, past link https://github.com/Sod3n/AniMate.git?path=/Assets/Plugins/AniMate and click “add” button.

How to play animation

  1. Add Animator to gameobject.
  2. Then add AniMateComponent to gameobject and attach already created animator component.
  3. Now you can use this AniMateComponent to play AnimationClip. For example:
public class PlayAnimation : MonoBehaviour
{
    [SerializeField] private AnimationClip _animationClip;
    [SerializeField] private AniMateComponent _aniMate;

    void Start()
    {
        _aniMate.Play(_animationClip);
    }
}

AniMateState

Play method of AniMateComponent return AniMateState. For now its pretty small class:

public class AniMateState
{
    public AnimatorState State { get; set; }
    public Action OnEnd { get; set; }

    public void Reset()
    {
        /* Reset logic */
    }
}

As you can see it contains OnEnd Action. It invokes only after not looping animation fully played. For example:

public class PlayAnimation : MonoBehaviour
{
    [SerializeField] private AnimationClip _animationClip;
    [SerializeField] private AniMateComponent _aniMate;

    void Start()
    {
        var state = _aniMate.Play(_animationClip);
        state.OnEnd += WaiterOne;

        state = _aniMate.Play(_animationClip);
        state.OnEnd += WaiterTwo;
    }

    private void WaiterOne()
    {
        Debug.Log("End 1");
    }
    private void WaiterTwo()
    {
        Debug.Log("End 2");
    }
}

In this example only “End 2” will be showed in console.

Also you can modify some AnimatorState properties and that will affect on animation.

animate's People

Contributors

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