Time for action – skewing an element from left to right

We can now add the function that skews an element from left to flat and from flat to right. This function is very similar to the function we just looked at. Changes in the code are shown in bold:

function skewLTR() {

  var flat = flow.find(".flat"),
    preFlat = flat.prev(),
    flatMatrix = matrix.slice(0),
    preMatrix = matrix.slice(0),
    flatDims = 200,
    preDims = 170,

    skew = function() {

      if (preFlat.length) {

        if (flatMatrix[3] >= -30 * oneRad && flatMatrix[5] >=-10 * oneRad) {

          var preTranslateX = parseInt(preMatrix[9].split("p")[0], 10),
          preTranslateY = parseInt(preMatrix[10].split("p")[0], 10);
          flatMatrix[1] = flatMatrix[1] - 0.001;
          flatMatrix[3] = flatMatrix[3] - oneRad;
 flatMatrix[5] = flatMatrix[5] ...

Get jQuery 1.4 Animation Techniques Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.