GithubHelp home page GithubHelp logo

software-mansion-labs / babel-plugin-animated-block Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 236 KB

Babel plugin to simplify RN animated expression

JavaScript 29.65% Python 17.26% Java 14.05% Objective-C 39.03%

babel-plugin-animated-block's Introduction

babel-plugin-animated-block

Babel 6 plugin that simplify animated expressions in React Native. In usage it could compared to deprecated with keyword

Before:

  animate() {
    this.sampleValue.setValue(0.3);
    { // Animated
      sequence([
        timing(
          this.sampleValue,
          {
            toValue: 0.7,
          }
        ),
        spring(
          this.sampleValue,
          {
            toValue: 1.3,
            friction: 1,
            tension: 1
          }
        )
      ]).start();
    }
  }

After:

  animate() {
    this.sampleValue.setValue(0.3);
    Animated.sequence([
      Animated.timing(
        this.sampleValue,
        {
          toValue: 0.7,
        }
      ),
      Animated.spring(
        this.sampleValue,
        {
          toValue: 1.3,
          friction: 1,
          tension: 1
        }
      )
    ]).start();
  }

I'll happily accept PRs for any further improvements to the project!

Usage

Add to your babelrc:

{
  "env": {
    "test": {
      "plugins": ["babel-plugin-animated-block"]
    }
  }
}

Example

cd example
yarn
react-native run-android / react-native run-ios

Build production

In order to test you need to build your changes

yarn prepublish

babel-plugin-animated-block's People

Contributors

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