Giter VIP home page Giter VIP logo

animejs-builder's Introduction

Depreciated

AnimeJS Builder ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ

min size npm version

A sequential animation building tool for the Anime.js library. Allowing for smooth, seamless, and modular animations.

Installation ๐Ÿ’ป

NPM ๐Ÿ’ 

$ npm install animejs
$ npm install animejs-builder

Yarn ๐Ÿ’ 

$ yarn add animejs
$ yarn add animejs-builder

CDN ๐Ÿ’ 

<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/AnimeBuilder.iife.min.js"></script>

CDN Link Here

How to Use Example ๐Ÿ‰

AnimeJS Config Docs

import anime from 'animejs';
import AnimeBuilder from 'animejs-builder'

const moveHorizontal = (length, duration) => {
  return {
    translateX: [
      {
        value: length, 
        duration: duration, 
        easing: 'easeInOutQuad'
      }
    ]
  }
}

const builder = new AnimeBuilder({
  targets: '.circle',
  autoplay: true
});

const animation = builder
  .add(moveHorizontal(200, 500))
  .add(moveHorizontal('+=200', 800))
  .add(moveHorizontal(0, 1000))
  .generateAnime();

CodePen ๐ŸŒ€

Restrictions โ˜ข๏ธ

  • Currently, properties must be defined in the array format

    translateX: [
      {
        value: length, 
        duration: duration, 
        easing: 'easeInOutQuad'
      }
    ]
    

Features ๐ŸŽ

Placeholders ๐Ÿ—ป

The Anime Builder adds property placeholders, so each additional animation happens sequentially after the other.

For example, look at the following

const animation = builder
  .add({
    translateX: [
      {value: 100, duration: 1000}
    ]
  })
  .add({
    scaleX: [
      {value: 5, duration: 500}
    ]
  })
  .generateAnime();

When scaleX is added. A placeholder value for scaleX is added with a duration of 500. Internally the values will look like this.

{
  translateX: [
    {value: 100, duration: 1000}
  ]
  scaleX: [
    {value: '*=1', duration: 1000},
    {value: 5, duration: 500}
  ]
}

These placeholder values are added for any property in order to align each animation addition.

Methods โš”๏ธ

class AnimeBuilder([options])

options - {Object}

They are AnimeJS config options: Anime JS Docs Here

description

Creates a new instance of AnimeBuilder

add([properties])

properties - {Object of Property Arrays}

1. i.e

{
  translateX: [
    { value: 100, duration: 1000}
  ]
}

2. i.e

{
  opacity: [
    { value: 100, duration: 1000}
  ],
  rotateX: [
    { value: '80deg', duration: 800},
    { value: '0deg', duration: 400}
  ]
}

@returns - {current AnimeBuilder instance}

generateAnime()

@returns { AnimeJS instance }

This generates the actual animejs animation.

More Coming Soon ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

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.