Coder Social home page Coder Social logo

larshelg / phobos Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andreloureiro/phobos

0.0 2.0 0.0 1014 KB

A ClojureScript wrapper to use Velocity React in Reagent apps

Home Page: http://andreloureiro.github.io/phobos

Clojure 6.25% JavaScript 92.85% CSS 0.78% HTML 0.12%

phobos's Introduction

Phobos

A ClojureScript wrapper to use Velocity React in Reagent apps. With Phobos you can easily add transitions to your UI.

Clojars Project

Demo

See at http://andreloureiro.github.io/phobos

Usage

First, some attention to your project dependencies. Phobos depends on cljsjs/react-with-addons because of the TransitionGroup component, so the developer is responsible to choose the React version needed to the project. One should exclude the cljsjs/react dependency from reagent, and add the proper cljsjs/react-with-addons version:

  [reagent "0.6.0-alpha" :exclusions [cljsjs/react]]
  [cljsjs/react-with-addons "15.0.1-1"]
  [phobos "0.1.0-SNAPSHOT"]

Phobos has 2 components: motion-component and motion-group. Both accepts a map with configs as its first argument, and the child component our collection of components as its second argument.

motion-component

If you need to animate one component, you should go with motion-component. It accepts the following properties:

  • animation: Animation config
  • target-query-selector: Used to animate a descendant of the child component.
  • run-on-mount: Run the animation when the component is mounted.

Other properties like duration, delay, loop etc are passed directly to Velocity.js.

motion-group

Wraps the VelocityTransitionGroup component. Useful when you want to apply transitions for items in a list when they are inserted and/or removed. You can apply the following properties to the wrapper:

  • enter: Animation config for execution in the time that the component is mounted.
  • leave: Same as enter, but for unmounting components.
  • run-on-mount: Run the animation when the component is mounted.

As with motion-component, other properties like component, class-name, etc are passed directly as props to the ReactTransitionGroup component.

Transitions

For the transitions, you have two options: Ready-to-use Velocity pre-registered UI Pack effects, or create your own.

If you go with the later, you can use a function register-effect provided by Phobos. You can define a custom Velocity UI Pack effect to use with the animation property of both motion-component and motion-group components. You have some advantages over declaring your animations as style hashes, like animation chaining. You can get more information in the Velocity UI Pack section of Velocity.js site.

But if the provided pre-registered animations are enough for you to achieve what you need, you can check the available effects here.

Credits

All credits go to the people from the Velocity React library for its amazing work.

License

Copyright © 2016 Andre Loureiro

Licensed under the MIT License: https://opensource.org/licenses/MIT

phobos's People

Contributors

andreloureiro avatar

Watchers

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