Giter Site home page Giter Site logo

jquery.css3.transforms's Introduction

jquery.css3.transforms

jquery.css3.transforms lets you get and set rotate, translate, scale, skew and perspective via jQuery css and animate methods.

Features

  • Cross browser support
  • Incremental and decremental setters support
  • You can use transformation with jQuery.animate (see the example below)

Limitations

  • Matrix is not supported
  • You can only use single valued transformations e.g. translate(x,y) is not supported
  • Limited support for measurement units different from px and deg

Example Usage

// SETTERS

// Translate (values in px)
$("#square").css("translateX", 20);
$("#square").css("translateY", -100);

// ...this works as well
$("#square").css("translateX", "20px");
$("#square").css("translateY", "-100px");
 
// 20deg 2D rotation (values in deg)
$("#square").css("rotate", 20);

// 20deg 3D rotations (values in deg)
$("#square").css("rotateX", 20);
$("#square").css("rotateY", 20);
$("#square").css("rotateZ", 20);

// ...this works as well
$("#square").css("rotate",  "20deg");
$("#square").css("rotateX", "20deg");
$("#square").css("rotateY", "20deg");
$("#square").css("rotateZ", "20deg");


// Scale
$("#square").css("scale", 1.2);
$("#square").css("scaleX", 1.2);
$("#square").css("scaleY", 1.2);
$("#square").css("scaleZ", 1.2);

// Skew (values in deg)
$("#square").css("skewX", 30);
$("#square").css("skewY", 30);

//...this works as well
$("#square").css("skewX", "30deg");
$("#square").css("skewY", "30deg");

// Perspective (values in px)
$("#square").css("perspective", 1000)

//...this works as well
$("#square").css("perspective", "1000px")

// Incremental and decremental setters are supported
$("#square").css("rotate", "+=20");
$("#square").css("rotate", "-=20");


// GETTERS
// All the getters return numeric values
// For rotations: values are returned in deg
// For translations: value are returned in px
// For skews: values are returned in deg
// For perspective: values are returned in px
// Here some examples:


$("#square").css("rotate", "20deg");
$("#square").css("rotate");
// This will return 20


// Animations
$("#square").animate({ rotate: 20, translateX: 100}, 600);

// Support detection
$.transform.isSupported()

jquery.css3.transforms's People

Contributors

lucavandro avatar

Stargazers

Kojiro Futamura avatar

Watchers

Wz avatar  avatar Calvin Juárez avatar

Forkers

guzuomuse

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.