Giter Site home page Giter Site logo

proparty's Introduction

#Propaty.js v0.1.0

Demos and documentation here

Proparty is a small javascript library that makes defining CSS transitions and animations a breeze.

##The Basics

pp('.example')
  .set('top', '80%')
  .setWithVendor('border-radius', '100px')
  .start();

##Multiple Values

pp('.example')
  .set('top', ['80%', '60%'])
  .set('left', ['80%', '20%', '%50'])
  .start();

##Cycle

pp('.example', { cycle: 7 })
  .set('top', ['80%', '60%', '%20', '40%'])
  .set('left', ['80%', '20%', '%50'])
  .start();

##Duration/Delay

pp('.example')
  .setSettings({ duration: 1000, delay: 250, initialDelay: 500 })
  .set('padding', ['40px', '20px'])
  .set('opacity', ['0.5', '1.0'])
  .start();

##Easing

pp('.example', { ease: 'in' })
 .set('top', '80%')
 .start();

##Transforms

pp('.example')
  .set('top', ['80%', '30%', '50%'])
  .transform('rotateX', ['180deg', '360deg', '0deg'])
  .transform('rotateY', ['180deg', '0deg'])
  .start();

##Animations

pp('.example')
  .setDuration(1000)
  .animate('twisterInDown')
  .start();

##Using Functions

pp('.example')
  .setCycle(5)
  .set('top', function () { 
    return Math.floor((Math.random() * 80) + 1) + '%'; 
  })
  .transform('rotateX', [
    function () { return (this.inc + 1) * 15 + 'deg'; },
    function () { return (this.inc + 1) * 20 + 'deg'; },
  ])
  .start();

##Adding/Subtracting

pp('.example')
  .setCycle(5)
  .set('top', pp.math.subtract('40px'))
  .set('left', pp.math.add('40px'))
  .start();

##Methods

var ppExample = pp('.example')
  .setCycle(true)
  .set('top', ['15%', '85%', '85%', '15%'])
  .set('left', ['15%', '15%', '85%', '85%'])
  .set('background-color', function () { 
    return '#' + (Math.random().toString(16) + '000000').slice(2, 8); 
  });
  .start();


// pause transitions
ppExample.pause();

// stop transitions
ppExample.stop();

// destroy and call any queued up transitions
ppExample.destroy();

##Callbacks

pp('.example')
  .setCycle(6)
  .transform('skew', ['20deg, 60deg', '-20deg, -60deg', '0deg, 0deg'])
  .transform('rotateY', ['180deg', '180deg', '0deg'])
  .whenStarted(function () { $('.text').html('Started!'); })
  .whenPaused(function () { $('.text').html('Paused!'); })
  .whenStopped(function () { $('.text').html('Stopped!'); })
  .start();

##Chaining

pp('.example')
  .set('top', ['20%', '80%'])
  .set('left', '20%')
  .chain(function () {
    return pp('.example-two')
      .set('top', ['20%', '80%'])
      .set('left', '80%')
  });
  .start();

##Supported Browsers

Proparty supports all modern browsers with CSS transition support as well as IE9.

##Dependencies

None! Proparty is compatible with jQuery but does not require it.

##Roadmap

  • Support for CSS3 animations.
  • Allowing mulitple elements to be animated with the same instance.
  • Forcing hardware acceleration to improve iOS performance.
  • Reduce internal state to allow for branching off of transitions without mutatation.

##Credits

Proparty was inspired by move.js, special thanks to the creators for an awesome library!

##License

Copyright (C) 2012-2013 Jordan Schroter

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Bitdeli Badge

proparty's People

Contributors

bitdeli-chef avatar

Watchers

James Cloos avatar Maciej Pankiewicz 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.