• Stars
    star
    437
  • Rank 99,659 (Top 2 %)
  • Language
    JavaScript
  • Created over 14 years ago
  • Updated over 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

jQuery 2d transformation plugin

NO LONGER MAINTAINED

As a note, I'm no longer maintaining this library. There was a much simpler library by Louis Remi. I forked it a while back and ported over the portions of my library that were missing from his. Louis' approach is much simpler and more performant.

My fork is here

Louis Remi's is here

2D Transformations

This library uses native CSS3 transformations in supported browsers and relies on the matrix filter in Internet Explorer 8 and below.

NOTE: In Internet Explorer 8 and below, the transform-origin and the translate functions are simulated using relative positioning. Because of this, in Internet Explorer 8 and below, the top and left position of an element will be incorrect after it has been transformed. The solution is to wrap the element that is to be transformed and position that wrapper instead.

  • Since 0.9.0, proper units are required
  • Since 0.9.0, jQuery 1.4.3 or above is required

Supported Browsers

  • Native CSS3 Support
    • FireFox 3.5+
    • Safari 3.1+
    • Chrome
    • Opera 10.5+
    • Internet Explorer 9+
  • Matrix Filter Support
    • Internet Explorer 5.5 - 8

Usage

// Rotate 30 Degrees
$('#example').transform({rotate: '30deg'});

// Use CSS Hooks to Rotate
$('#example').css({rotate: '30deg'});

// Animate the rotation
$('#example').animate({rotate: '30deg'});

// Go Crazy
$('#example').transform({
	matrix: [1, 0, 0, 1, 0, 0], //applies a matrix
	reflect: true, //same as rotate(180deg)
	reflectX: true, //mirrored upside down
	reflectXY: true, //same as reflectX + rotate(-90deg)
	reflectY: true, //mirrored
	rotate: '45deg', //rotates 45 degrees
	skew: ['10deg', '10deg'], //skews 10 degrees on the x and y axis
	skewX: '10deg', //skews 10 degrees on the x axis
	skewY: '10deg', //skews 10 degrees on the y axis
	scale: [1.5, 1.5], //scales by 1.5 on the x and y axis
	scaleX: 1.5, //scales by 1.5 on the x axis
	scaleY: 1.5, //scales by 1.5 on the y axis
	translate: ['20px', '20px'], //moves the transformation 20px on the x and y axis
	translateX: 20px', //moves the transformation 20px on the x axis
	translateY: '20px', //moves the transformation 20px on the y axis
	origin: ['20%', '20%']  //changes the transformation origin
});

// Properties can be strings or arrays
$('#example').css({skew: ['10deg', '10deg']});
$('#example').css({skew: '10deg, 10deg'});

// For animation, arrays should be nested because of jQuery's per-property easing support
$('#example').animate({skew: ['10deg', '10deg']}); // technically this defines nonsense easing of 10deg
$('#example').animate({skew: [['10deg', '10deg']]}); // this is a friendlier way of supporting this

More Repositories

1

scss-blend-modes

Using standard color blending functions in SASS.
CSS
821
star
2

compass-photoshop-drop-shadow

Compass mixin for using the dropshadow values that Photoshop uses. Making it easier to convert PSD files to CSS.
Ruby
119
star
3

textshadow

An IE compatible text-shadow polyfill.
JavaScript
88
star
4

Units

JavaScript library for converting CSS units.
JavaScript
59
star
5

compass-grid-plugin

Compass grid plugin inspired by the 1KB CSS grid. Supports fixed and fluid grids.
Ruby
50
star
6

curve

Functions for drawing time-based curves.
JavaScript
22
star
7

react-redux-notes

Notes on using React-Redux
17
star
8

ace-mode-twig

A mode for the Ace JavaScript text editor for highlighting Twig templates.
JavaScript
12
star
9

transform3d

a jQuery library for faking 3d transformations in all browsers.
JavaScript
11
star
10

docker-wordpress-starterkit

Starter kit for running Wordpress in development using Docker
Shell
11
star
11

1KB-SCSS-Grid

SCSS Grid based on -- but different than -- the 1KB CSS Grid (http://1kbgrid.com/)
Ruby
9
star
12

corners

jQuery Corners
Ruby
5
star
13

holy-grail-app

Example create react app with server-side rendering and critical style loading
JavaScript
5
star
14

compass-sprockets

tool for watching a directory and using Sprockets to combine and minify the files.
Ruby
5
star
15

redux-saga-watch-actions

Convenience methods for creating a saga that watches for actions
JavaScript
5
star
16

fetch-actions

Dispatch actions to handle fetch requests
JavaScript
4
star
17

redux-selectors

Helpers for creating state selectors in a redux application
JavaScript
3
star
18

jquery.truncate

Truncate text to be a specific height.
JavaScript
2
star
19

blog

JavaScript
2
star
20

ace-mode-freemarker

FreeMarker mode for Ace JavaScript editor.
JavaScript
2
star
21

neutrino-preset-standard

Standard JS preset for Neutrino http://standardjs.com/
JavaScript
1
star