Giter Site home page Giter Site logo

riot-animate's Introduction

riot-animate - Animate Riot 2

npm status bower status

This riot mixin is inspired by ngAnimate, and provides an animation system for mounts and unmounts.

You can have an animation CSS class and use an ngAnimate style system, linking animations to riot-enter, riot-enter-active, riot-leave, and riot-leave-active.

To have animations on unmount, you must this.animateUnmount(). This allows for a 'leave' animation to occur before unmounting, i.e. removing DOM elements from the file.

In addition, you can easily use animate.css and use the attributes animate, animate-enter, and animate-leave, along with adding animate-delay and animate-duration.

Example

.fade.riot-animate {
	transition:0.5s linear all;
}

.fade.riot-enter,
.fade.riot-leave.riot-leave-active  {
	opacity:0;
}

.fade.riot-enter.riot-enter-active ,
.fade.riot-leave {
	opacity:1;
}
<timer></timer>

<script type="riot/tag">

<timer>
  // This is using a ngAnimate style 'enter' 'leave' css class
  <div class="card card-fade" animate="fade" animate-duration="300ms" animate-delay="1000ms">
    <p class="">Using ngAnimate style classes</p>
  </div>

  // This is using an animate.css
  <div class="card" each="{item, i in items}" animate="zoomIn" animate-leave="zoomOut" animate-duration="300ms" animate-delay="{i*20}ms">
    <p class="">Using animate.css</p>
  </div>

  this.items = opts.items;

  setTimeout(function(){
      // Special unmount function
    this.animatedUnmount();
  }.bind(this),3000);

  // This is how you add animation capabilities
  this.mixin(riotAnimate);

</timer>
</script>

<script>
    var items = [];
    for(var x=0;x<100;x++) {
      items.push({time: 'time'})
    }
    riot.mount('timer', {items: items});
</script>

Contributing

Not everything has been tested in extent yet. Please feel free to fork or submit an issue.

riot-animate's People

Contributors

nathanchapman avatar sartaj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

riot-animate's Issues

animate single elements out

Hi,
This is really cool. I love the angular method of animating elements into the DOM, and your implementation here is great.
But, i'm managing to get the elements to animate in, yet i can't figure out how to animate the elements out. I'm trying to get single elements to remove from DOM on click, and can't figure out the method (I could only manage to animate-out all elements from the dom, but not single ones)
My progress is in this codepen: codepen.io/rhmubus/pen/pRPLwO
Thank you!

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.