{"id":466,"date":"2012-09-12T21:19:31","date_gmt":"2012-09-12T21:19:31","guid":{"rendered":"http:\/\/a.parsons.edu\/~dejongo\/12-fall\/?p=466"},"modified":"2020-02-25T15:11:04","modified_gmt":"2020-02-25T15:11:04","slug":"10-2d-transform","status":"publish","type":"post","link":"https:\/\/b.parsons.edu\/~dejongo\/10-2d-transform\/","title":{"rendered":"10 2D&#038;3D Transforms"},"content":{"rendered":"<h2>Visual Formatting Model <\/h2>\n<figure style=\"float: right; width: 100px; padding-left: 15px;\"><img decoding=\"async\" src=\"http:\/\/b.parsons.edu\/~dejongo\/12-fall\/stuff\/08_Coordinate-System1.gif\" alt=\"Illustrator coordinate system\"\/><figcaption style=\"font-size: 70%; text-align: center;\">Illustrator<\/figcaption><\/figure>\n<figure style=\"float: left; width: 100px; padding-right: 15px;\"><img decoding=\"async\" src=\"http:\/\/b.parsons.edu\/~dejongo\/12-fall\/stuff\/08_Coordinate-System2.gif\" alt=\"Web coordinate system\"\/><figcaption style=\"font-size: 70%; text-align: center; line-height: 100%;\">web coordinate system<\/figcaption><\/figure>\n<p>The web browser lays out the page according to a coordinate system that, by default, is expressed in pixels and has the X and Y Zero point in the upper left hand corner of the parent object, like InDesign. Illustrator places it on the lower right hand corner, the way you learned it in geometry.<\/p>\n<h2>2D Transform<\/h2>\n<\/p>\n<p>The <strong>transform<\/strong> property modifies this coordinate space, so that elements can be translated, rotated and scaled in this two dimensional space. When you create a value for the transform property, a new local coordinate system is established by which the position of the element is calculated. The 2D transforms add up, meaning that if you rotate the parent element, and then rotate the child element, the child will be rotated in addition to the parent&#8217;s rotation. The coordinate system then calculates the cumulative transformation matrix (CTM) for the element.\n<\/p>\n<p>You can apply two different transforms to the X and Y axis with the transform property values <code>transform: &lt;transform-function for X>  &lt;transform-function for Y>;<\/code> where the <a href=\"http:\/\/www.w3.org\/TR\/css3-transforms\/#two-d-transform-functions\">2D transform functions<\/a> are listed in length or percentages and angles in degrees, grads, radians or turns (according to the CSS3 <a href=\"http:\/\/www.w3.org\/TR\/css3-values\/#angles\">values and units<\/a>):<\/p>\n<ul style=\"list-style: none;\">\n<li><strong>matrix(number, number, number, number, number, number)<\/strong><br \/>\nMatrix specifies a 2D transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix [a b c d e f].\n<\/li>\n<li><strong>translate(value for x, value for y)<\/strong><br \/>\ntranslate specifies a 2D translation by the vector [tx, ty], where tx is the first translation-value parameter and ty is the optional second translation-value parameter. If &lt;ty> is not provided, ty has zero as a value.\n<\/li>\n<li><strong>translateX(value)<\/strong><br \/>\nTranslate X specifies a translation by the given amount in the X direction.\n<\/li>\n<li><strong>translateY(value)<\/strong><br \/>\nTranslate Yspecifies a translation by the given amount in the Y direction.\n<\/li>\n<li><strong>scale(value for x, value for y)<\/strong><br \/>\nScale specifies a 2D scale operation by the [sx,sy] scaling vector described by the 2 parameters. If the second parameter is not provided, it is takes a value equal to the first.\n<\/li>\n<li><strong>scaleX(value)<\/strong><br \/>\nScale X specifies a scale operation using the [sx,1] scaling vector, where sx is given as the parameter.\n<\/li>\n<li><strong>scaleY(value)<\/strong><br \/>\nScale Y specifies a scale operation using the [1,sy] scaling vector, where sy is given as the parameter.\n<\/li>\n<li><strong>rotate(angle)<\/strong><br \/>\nRotate specifies a 2D rotation by the angle specified in the parameter about the origin of the element, as defined by the transform-origin property.\n<\/li>\n<li><strong>skewX(angle)<\/strong><br \/>\nSkew X specifies a skew transformation along the X axis by the given angle.\n<\/li>\n<li><strong>skewY(angle)<\/strong><br \/>\nSkew Y specifies a skew transformation along the Y axis by the given angle.\n<\/li>\n<li><strong>skew(angle, angle)<\/strong><br \/>\nSkew X and Y specifies a skew transformation along the X and Y axes. The first angle parameter specifies the skew on the X axis. The second angle parameter specifies the skew on the Y axis. If the second parameter is not given then a value of 0 is used for the Y angle (ie. no skew on the Y axis).\n<\/li>\n<\/ul>\n<p>If your object is small, it is not a problem to establish its position on the default coordinate system, and tweaking its relative position if need be, but for some objects, it is better that you control the point of the transformation, which by default is the midpoint of the object.\n<\/p>\n<p>You can set the 0,0 point to determine the point of transformation using percentage, length, or keyword like left, center and right for the X axis and top, center and bottom for the Y axis: <code>transform-origin: left top <\/code>\n<\/p>\n<p>If only one element is is specified, the second value is assumed to be center.\n<\/p>\n<p>Transform can be used locally or global. First, it is a local way of turning objects that does not involve the structure of the layout itself. The second way is to transform large parts of the document, and since the children inherit the parent&#8217;s transforms, all the children will take on that transformation. <\/p>\n<h2>Local Transforms<\/h2>\n<div class=\"handson_demo\">\n<h3>CSS Code View<\/h3>\n<pre>\r\n<style contenteditable=\"true\">\r\n#transform-demo {\r\nwidth: 200px;\r\nheight: 200px;\r\npadding: 20px;\r\noverflow: auto;\r\nmargin: auto;\r\nbackground-color: yellow;\r\ntransform-origin: top left;\r\ntransition: all 1s ease;\r\ntransform: scale(1) rotate(45deg) \r\ntranslate(0px, 0px) skew(0deg, 0deg);\r\n}<\/style><\/pre>\n<\/div>\n<div id=\"transform-demo\">\n<img decoding=\"async\" style=\"float: right; padding: 0 0 10px 10px; margin:0;\" src=\"http:\/\/b.parsons.edu\/~dejongo\/12-fall\/stuff\/07_CSS-border-image1.gif\" alt=\"border image\" \/><br \/>\nThe content (children) of the transformed element inherit the altered coordinate space, and transform with it, such as this text and image.\n<\/div>\n<h2 style=\"padding-top: 100px;\">global Transforms<\/h2>\n<\/p>\n<p>Here you will transform the entire content element on this page from the center, with everything on it. Every child element gets transformed with the parent.\n<\/p>\n<p>Change the values for both the transform origin and the transform scale, rotate, transform and skew. Careful, for you can lose the ability to edit this if you make too radical a change, and will need to refresh the page to reset it. Try rotating the element by 90\u00b0, 180\u00b0 or 360 degrees.<\/p>\n<div class=\"handson_demo\">\n<h3>CSS Code View<\/h3>\n<pre>\r\n<style contenteditable=\"true\">\r\n#content {\r\nz-index: 10000;\r\ntransform-origin: center center;\r\ntransition: all 6s ease;\r\ntransform: scale(1) rotate(-1deg) \r\ntranslate(0px, 0px) skew( 0deg, 0deg);\r\n}<\/style><\/pre>\n<\/div>\n<h2>Use Cases<\/h2>\n<\/p>\n<p class=\"codepen\" data-height=\"612\" data-theme-id=\"light\" data-default-tab=\"result\" data-user=\"enbee81\" data-slug-hash=\"yLyrmyg\" style=\"height: 612px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-pen-title=\"Diagonal Layouts in 2020\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/enbee81\/pen\/yLyrmyg\"><br \/>\n  Diagonal Layouts in 2020<\/a> by Nils Binder (<a href=\"https:\/\/codepen.io\/enbee81\">@enbee81<\/a>)<br \/>\n  on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/span>\n<\/p>\n<p><script async src=\"https:\/\/static.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<h2 style=\"margin-top: 100px\">Front End Interfaces<\/h2>\n<p>A lot of activity is happening with these tools, and you can expect Illustrator-like drawing programs at the front end that use CSS and HTML as the backend language. Check out this text on a path <a href=\"http:\/\/csswarp.eleqtriq.com\/\">generator<\/a> and don&#8217;t forget to look at his explanation of  <a href=\"https:\/\/w3.eleqtriq.com\/2010\/11\/natural-object-rotation-with-css3-3d\/\">Natural Object-Rotation with CSS Transform 3D<\/a> and  <a href=\"https:\/\/w3.eleqtriq.com\/2010\/11\/showcase-a-pop-up-book-in-html-and-css\/\">pop-up book <\/a>example.\n<link rel='stylesheet' type='text\/css' href='http:\/\/fonts.googleapis.com\/css?family=Crushed'\/>\n<style>#warped {position: relative; display: block; width:646px; height:541px;}\n#warped>span[class^=w]:nth-of-type(n+0){display:block; position:absolute;-moz-transform-origin:50% 100%; -webkit-transform-origin:50% 100%; -o-transform-origin:50%100%; -ms-transform-origin:50% 100%; transform-origin:50% 100%; }\n#warped span{font-family:'Crushed', sans-serif; font-size:38px;font-weight:normal;font-style:normal; color: #000; line-height:0.65; white-space:pre; overflow:visible; padding:0px;}\n#warped .w0 {-moz-transform: rotate(-0.47rad);-webkit-transform: rotate(-0.47rad);-o-transform:rotate(-0.47rad);-ms-transform: rotate(-0.47rad); transform: rotate(-0.47rad);width: 7px; height: 24px; left: 229.9px; top: 91.47px;}\n#warped .w1 {-moz-transform: rotate(-0.34rad);-webkit-transform: rotate(-0.34rad);-o-transform:rotate(-0.34rad);-ms-transform: rotate(-0.34rad); transform: rotate(-0.34rad);width: 26px; height: 24px; left: 240.22px; top: 83.18px;}\n#warped .w2 {-moz-transform: rotate(-0.18rad);-webkit-transform: rotate(-0.18rad);-o-transform:rotate(-0.18rad);-ms-transform: rotate(-0.18rad); transform: rotate(-0.18rad);width: 16px; height: 24px; left: 270.35px; top: 76.63px;}\n#warped .w3 {-moz-transform: rotate(-0.05rad);-webkit-transform: rotate(-0.05rad);-o-transform:rotate(-0.05rad);-ms-transform: rotate(-0.05rad); transform: rotate(-0.05rad);width: 18px; height: 24px; left: 291.2px; top: 74.18px;}\n#warped .w4 {-moz-transform: rotate(0.05rad);-webkit-transform: rotate(0.05rad);-o-transform:rotate(0.05rad);-ms-transform: rotate(0.05rad); transform: rotate(0.05rad);width: 7px; height: 24px; left: 314.19px; top: 74.28px;}\n#warped .w5 {-moz-transform: rotate(0.16rad);-webkit-transform: rotate(0.16rad);-o-transform:rotate(0.16rad);-ms-transform: rotate(0.16rad); transform: rotate(0.16rad);width: 18px; height: 24px; left: 326.08px; top: 76.19px;}\n#warped .w6 {-moz-transform: rotate(0.29rad);-webkit-transform: rotate(0.29rad);-o-transform:rotate(0.29rad);-ms-transform: rotate(0.29rad); transform: rotate(0.29rad);width: 17px; height: 24px; left: 348.48px; top: 81.29px;}\n#warped .w7 {-moz-transform: rotate(0.39rad);-webkit-transform: rotate(0.39rad);-o-transform:rotate(0.39rad);-ms-transform: rotate(0.39rad); transform: rotate(0.39rad);width: 7px; height: 24px; left: 369.46px; top: 87.06px;}\n#warped .w8 {-moz-transform: rotate(0.48rad);-webkit-transform: rotate(0.48rad);-o-transform:rotate(0.48rad);-ms-transform: rotate(0.48rad); transform: rotate(0.48rad);width: 13px; height: 24px; left: 380.02px; top: 93.47px;}\n#warped .w9 {-moz-transform: rotate(0.6rad);-webkit-transform: rotate(0.6rad);-o-transform:rotate(0.6rad);-ms-transform: rotate(0.6rad); transform: rotate(0.6rad);width: 18px; height: 24px; left: 395.01px; top: 104.14px;}\n#warped .w10 {-moz-transform: rotate(0.73rad);-webkit-transform: rotate(0.73rad);-o-transform:rotate(0.73rad);-ms-transform: rotate(0.73rad); transform: rotate(0.73rad);width: 16px; height: 24px; left: 413.19px; top: 117.85px;}\n#warped .w11 {-moz-transform: rotate(0.85rad);-webkit-transform: rotate(0.85rad);-o-transform:rotate(0.85rad);-ms-transform: rotate(0.85rad); transform: rotate(0.85rad);width: 13px; height: 24px; left: 428.3px; top: 131.8px;}\n#warped .w12 {-moz-transform: rotate(0.94rad);-webkit-transform: rotate(0.94rad);-o-transform:rotate(0.94rad);-ms-transform: rotate(0.94rad); transform: rotate(0.94rad);width: 7px; height: 24px; left: 440.63px; top: 143.54px;}\n#warped .w13 {-moz-transform: rotate(1.03rad);-webkit-transform: rotate(1.03rad);-o-transform:rotate(1.03rad);-ms-transform: rotate(1.03rad); transform: rotate(1.03rad);width: 13px; height: 24px; left: 445.86px; top: 156.08px;}\n#warped .w14 {-moz-transform: rotate(1.15rad);-webkit-transform: rotate(1.15rad);-o-transform:rotate(1.15rad);-ms-transform: rotate(1.15rad); transform: rotate(1.15rad);width: 18px; height: 24px; left: 452.75px; top: 174.29px;}\n#warped .w15 {-moz-transform: rotate(1.26rad);-webkit-transform: rotate(1.26rad);-o-transform:rotate(1.26rad);-ms-transform: rotate(1.26rad); transform: rotate(1.26rad);width: 7px; height: 24px; left: 464.45px; top: 190.64px;}\n#warped .w16 {-moz-transform: rotate(1.35rad);-webkit-transform: rotate(1.35rad);-o-transform:rotate(1.35rad);-ms-transform: rotate(1.35rad); transform: rotate(1.35rad);width: 14px; height: 24px; left: 465px; top: 205.6px;}\n#warped .w17 {-moz-transform: rotate(1.44rad);-webkit-transform: rotate(1.44rad);-o-transform:rotate(1.44rad);-ms-transform: rotate(1.44rad); transform: rotate(1.44rad);width: 7px; height: 24px; left: 471.16px; top: 220.86px;}\n#warped .w18 {-moz-transform: rotate(1.51rad);-webkit-transform: rotate(1.51rad);-o-transform:rotate(1.51rad);-ms-transform: rotate(1.51rad); transform: rotate(1.51rad);width: 7px; height: 24px; left: 472.24px; top: 232.81px;}\n#warped .w19 {-moz-transform: rotate(1.6rad);-webkit-transform: rotate(1.6rad);-o-transform:rotate(1.6rad);-ms-transform: rotate(1.6rad); transform: rotate(1.6rad);width: 14px; height: 24px; left: 468.88px; top: 248.3px;}\n#warped .w20 {-moz-transform: rotate(1.7rad);-webkit-transform: rotate(1.7rad);-o-transform:rotate(1.7rad);-ms-transform: rotate(1.7rad); transform: rotate(1.7rad);width: 7px; height: 24px; left: 471.08px; top: 263.74px;}\n#warped .w21 {-moz-transform: rotate(1.8rad);-webkit-transform: rotate(1.8rad);-o-transform:rotate(1.8rad);-ms-transform: rotate(1.8rad); transform: rotate(1.8rad);width: 19px; height: 24px; left: 461.8px; top: 281.43px;}\n#warped .w22 {-moz-transform: rotate(1.94rad);-webkit-transform: rotate(1.94rad);-o-transform:rotate(1.94rad);-ms-transform: rotate(1.94rad); transform: rotate(1.94rad);width: 18px; height: 24px; left: 455.21px; top: 303.82px;}\n#warped .w23 {-moz-transform: rotate(2.06rad);-webkit-transform: rotate(2.06rad);-o-transform:rotate(2.06rad);-ms-transform: rotate(2.06rad); transform: rotate(2.06rad);width: 13px; height: 24px; left: 449.02px; top: 322.37px;}\n#warped .w24 {-moz-transform: rotate(2.18rad);-webkit-transform: rotate(2.18rad);-o-transform:rotate(2.18rad);-ms-transform: rotate(2.18rad); transform: rotate(2.18rad);width: 15px; height: 24px; left: 438.01px; top: 338.51px;}\n#warped .w25 {-moz-transform: rotate(2.27rad);-webkit-transform: rotate(2.27rad);-o-transform:rotate(2.27rad);-ms-transform: rotate(2.27rad); transform: rotate(2.27rad);width: 7px; height: 24px; left: 432.21px; top: 351.15px;}\n#warped .w26 {-moz-transform: rotate(2.38rad);-webkit-transform: rotate(2.38rad);-o-transform:rotate(2.38rad);-ms-transform: rotate(2.38rad); transform: rotate(2.38rad);width: 18px; height: 24px; left: 414.66px; top: 363.83px;}\n#warped .w27 {-moz-transform: rotate(2.5rad);-webkit-transform: rotate(2.5rad);-o-transform:rotate(2.5rad);-ms-transform: rotate(2.5rad); transform: rotate(2.5rad);width: 13px; height: 24px; left: 401.47px; top: 377.01px;}\n#warped .w28 {-moz-transform: rotate(2.63rad);-webkit-transform: rotate(2.63rad);-o-transform:rotate(2.63rad);-ms-transform: rotate(2.63rad); transform: rotate(2.63rad);width: 22px; height: 24px; left: 378.05px; top: 389.15px;}\n#warped .w29 {-moz-transform: rotate(2.77rad);-webkit-transform: rotate(2.77rad);-o-transform:rotate(2.77rad);-ms-transform: rotate(2.77rad); transform: rotate(2.77rad);width: 13px; height: 24px; left: 362.18px; top: 398.65px;}\n#warped .w30 {-moz-transform: rotate(2.86rad);-webkit-transform: rotate(2.86rad);-o-transform:rotate(2.86rad);-ms-transform: rotate(2.86rad); transform: rotate(2.86rad);width: 7px; height: 24px; left: 350.96px; top: 403.44px;}\n#warped .w31 {-moz-transform: rotate(2.98rad);-webkit-transform: rotate(2.98rad);-o-transform:rotate(2.98rad);-ms-transform: rotate(2.98rad); transform: rotate(2.98rad);width: 26px; height: 24px; left: 320.48px; top: 408.05px;}\n#warped .w32 {-moz-transform: rotate(3.14rad);-webkit-transform: rotate(3.14rad);-o-transform:rotate(3.14rad);-ms-transform: rotate(3.14rad); transform: rotate(3.14rad);width: 16px; height: 24px; left: 299.58px; top: 409.99px;}\n#warped .w33 {-moz-transform: rotate(3.25rad);-webkit-transform: rotate(3.25rad);-o-transform:rotate(3.25rad);-ms-transform: rotate(3.25rad); transform: rotate(3.25rad);width: 12px; height: 24px; left: 282.62px; top: 408.87px;}\n#warped .w34 {-moz-transform: rotate(3.36rad);-webkit-transform: rotate(3.36rad);-o-transform:rotate(3.36rad);-ms-transform: rotate(3.36rad); transform: rotate(3.36rad);width: 15px; height: 24px; left: 262.9px; top: 405.73px;}\n#warped .w35 {-moz-transform: rotate(3.49rad);-webkit-transform: rotate(3.49rad);-o-transform:rotate(3.49rad);-ms-transform: rotate(3.49rad); transform: rotate(3.49rad);width: 18px; height: 24px; left: 240.81px; top: 399.6px;}\n#warped .w36 {-moz-transform: rotate(3.62rad);-webkit-transform: rotate(3.62rad);-o-transform:rotate(3.62rad);-ms-transform: rotate(3.62rad); transform: rotate(3.62rad);width: 16px; height: 24px; left: 221.73px; top: 390.65px;}\n#warped .w37 {-moz-transform: rotate(3.72rad);-webkit-transform: rotate(3.72rad);-o-transform:rotate(3.72rad);-ms-transform: rotate(3.72rad); transform: rotate(3.72rad);width: 7px; height: 24px; left: 212.03px; top: 382.26px;}\n#warped .w38 {-moz-transform: rotate(3.81rad);-webkit-transform: rotate(3.81rad);-o-transform:rotate(3.81rad);-ms-transform: rotate(3.81rad); transform: rotate(3.81rad);width: 14px; height: 24px; left: 196px; top: 373.14px;}\n#warped .w39 {-moz-transform: rotate(3.92rad);-webkit-transform: rotate(3.92rad);-o-transform:rotate(3.92rad);-ms-transform: rotate(3.92rad); transform: rotate(3.92rad);width: 13px; height: 24px; left: 182.72px; top: 360.81px;}\n#warped .w40 {-moz-transform: rotate(4.03rad);-webkit-transform: rotate(4.03rad);-o-transform:rotate(4.03rad);-ms-transform: rotate(4.03rad); transform: rotate(4.03rad);width: 15px; height: 24px; left: 169.07px; top: 346.65px;}\n#warped .w41 {-moz-transform: rotate(4.15rad);-webkit-transform: rotate(4.15rad);-o-transform:rotate(4.15rad);-ms-transform: rotate(4.15rad); transform: rotate(4.15rad);width: 13px; height: 24px; left: 159.1px; top: 331.15px;}\n#warped .w42 {-moz-transform: rotate(4.27rad);-webkit-transform: rotate(4.27rad);-o-transform:rotate(4.27rad);-ms-transform: rotate(4.27rad); transform: rotate(4.27rad);width: 17px; height: 24px; left: 147.52px; top: 313.6px;}\n#warped .w43 {-moz-transform: rotate(4.4rad);-webkit-transform: rotate(4.4rad);-o-transform:rotate(4.4rad);-ms-transform: rotate(4.4rad); transform: rotate(4.4rad);width: 18px; height: 24px; left: 138.82px; top: 292.67px;}\n#warped .w44 {-moz-transform: rotate(4.51rad);-webkit-transform: rotate(4.51rad);-o-transform:rotate(4.51rad);-ms-transform: rotate(4.51rad); transform: rotate(4.51rad);width: 7px; height: 24px; left: 139.92px; top: 275.74px;}\n#warped .w45 {-moz-transform: rotate(4.63rad);-webkit-transform: rotate(4.63rad);-o-transform:rotate(4.63rad);-ms-transform: rotate(4.63rad); transform: rotate(4.63rad);width: 24px; height: 24px; left: 128.54px; top: 255.46px;}\n#warped .w46 {-moz-transform: rotate(4.75rad);-webkit-transform: rotate(4.75rad);-o-transform:rotate(4.75rad);-ms-transform: rotate(4.75rad); transform: rotate(4.75rad);width: 7px; height: 24px; left: 136.64px; top: 234.97px;}\n#warped .w47 {-moz-transform: rotate(4.84rad);-webkit-transform: rotate(4.84rad);-o-transform:rotate(4.84rad);-ms-transform: rotate(4.84rad); transform: rotate(4.84rad);width: 13px; height: 24px; left: 134.94px; top: 220.04px;}\n#warped .w48 {-moz-transform: rotate(4.96rad);-webkit-transform: rotate(4.96rad);-o-transform:rotate(4.96rad);-ms-transform: rotate(4.96rad); transform: rotate(4.96rad);width: 18px; height: 24px; left: 136.35px; top: 199.93px;}\n#warped .w49 {-moz-transform: rotate(5.06rad);-webkit-transform: rotate(5.06rad);-o-transform:rotate(5.06rad);-ms-transform: rotate(5.06rad); transform: rotate(5.06rad);width: 7px; height: 24px; left: 147.1px; top: 183.24px;}\n#warped .w50 {-moz-transform: rotate(5.16rad);-webkit-transform: rotate(5.16rad);-o-transform:rotate(5.16rad);-ms-transform: rotate(5.16rad); transform: rotate(5.16rad);width: 16px; height: 24px; left: 149.12px; top: 168.09px;}\n#warped .w51 {-moz-transform: rotate(5.28rad);-webkit-transform: rotate(5.28rad);-o-transform:rotate(5.28rad);-ms-transform: rotate(5.28rad); transform: rotate(5.28rad);width: 14px; height: 24px; left: 159.97px; top: 150.7px;}\n#warped .w52 {-moz-transform: rotate(5.4rad);-webkit-transform: rotate(5.4rad);-o-transform:rotate(5.4rad);-ms-transform: rotate(5.4rad); transform: rotate(5.4rad);width: 14px; height: 24px; left: 171.17px; top: 135.36px;}\n#warped .w53 {-moz-transform: rotate(5.49rad);-webkit-transform: rotate(5.49rad);-o-transform:rotate(5.49rad);-ms-transform: rotate(5.49rad); transform: rotate(5.49rad);width: 8px; height: 24px; left: 184.9px; top: 123.5px;}\n#warped .w54 {-moz-transform: rotate(5.35rad);-webkit-transform: rotate(5.35rad);-o-transform:rotate(5.35rad);-ms-transform: rotate(5.35rad); transform: rotate(5.35rad);width: 16px; height: 24px; left: 158.6px; top: 135.52px;}\n#warped .w55 {-moz-transform: rotate(5.47rad);-webkit-transform: rotate(5.47rad);-o-transform:rotate(5.47rad);-ms-transform: rotate(5.47rad); transform: rotate(5.47rad);width: 14px; height: 24px; left: 172.51px; top: 120.25px;}\n#warped .w56 {-moz-transform: rotate(5.57rad);-webkit-transform: rotate(5.57rad);-o-transform:rotate(5.57rad);-ms-transform: rotate(5.57rad); transform: rotate(5.57rad);width: 14px; height: 24px; left: 186.29px; top: 107.19px;}\n#warped .w57 {-moz-transform: rotate(5.66rad);-webkit-transform: rotate(5.66rad);-o-transform:rotate(5.66rad);-ms-transform: rotate(5.66rad); transform: rotate(5.66rad);width: 8px; height: 24px; left: 201.93px; top: 97.38px;}<\/p>\n<\/style>\n<div id='warped'><span class='w0'>I<\/span><span class='w1'>m<\/span><span class='w2'>a<\/span><span class='w3'>g<\/span><span class='w4'>i<\/span><span class='w5'>n<\/span><span class='w6'>e<\/span><span class='w7'> <\/span><span class='w8'>t<\/span><span class='w9'>h<\/span><span class='w10'>a<\/span><span class='w11'>t<\/span><span class='w12'> <\/span><span class='w13'>t<\/span><span class='w14'>h<\/span><span class='w15'>i<\/span><span class='w16'>s<\/span><span class='w17'> <\/span><span class='w18'>i<\/span><span class='w19'>s<\/span><span class='w20'> <\/span><span class='w21'>o<\/span><span class='w22'>n<\/span><span class='w23'>l<\/span><span class='w24'>y<\/span><span class='w25'> <\/span><span class='w26'>H<\/span><span class='w27'>T<\/span><span class='w28'>M<\/span><span class='w29'>L<\/span><span class='w30'> <\/span><span class='w31'>m<\/span><span class='w32'>a<\/span><span class='w33'>r<\/span><span class='w34'>k<\/span><span class='w35'>u<\/span><span class='w36'>p<\/span><span class='w37'> <\/span><span class='w38'>s<\/span><span class='w39'>t<\/span><span class='w40'>y<\/span><span class='w41'>l<\/span><span class='w42'>e<\/span><span class='w43'>d<\/span><span class='w44'> <\/span><span class='w45'>w<\/span><span class='w46'>i<\/span><span class='w47'>t<\/span><span class='w48'>h<\/span><span class='w49'> <\/span><span class='w50'>C<\/span><span class='w51'>S<\/span><span class='w52'>S<\/span><span class='w53'>!<\/span>\n              <\/div>\n<h2>Transition and Transform Animations<\/h2>\n<\/p>\n<p>It&#8217;s possible to animate the transformations using the psudo class <code>hover<\/code>. Much like the transition effect applied to the alpha of the overlying picture to make it fade upon hover, using transformations enhance the effect.<\/p>\n<style>\n.view {\n   width: 300px;\n   height: 200px;\n   margin: 10px auto;\n   float: left;\n   border: 10px solid #fff;\n   overflow: hidden;\n   position: relative;\n   text-align: center;\n   -webkit-box-shadow: 1px 1px 2px #e6e6e6;\n   -moz-box-shadow: 1px 1px 2px #e6e6e6;\n   box-shadow: 1px 1px 2px #e6e6e6;\n   cursor: default;\n   background: #fff url(..\/images\/bgimg.jpg) no-repeat center center;\n}\n.view .mask,.view .content {\n   width: 300px;\n   height: 200px;\n   position: absolute;\n   overflow: hidden;\n   top: 0;\n   left: 0;\n}\n.view img {\n   display: block;\n   position: relative;\n}\n.view h2 {\n   text-transform: uppercase;\n   color: #fff;\n   text-align: center;\n   position: relative;\n   font-size: 17px;\n   padding: 10px;\n   background: rgba(0, 0, 0, 0.8);\n   margin: 20px 0 0 0;\n}\n.view p {\n   font-family: Georgia, serif;\n   font-style: italic;\n   font-size: 12px;\n   position: relative;\n   color: #fff;\n   padding: 10px 20px 20px;\n   text-align: center;\n}\n.view a.info {\n   display: inline-block;\n   text-decoration: none;\n   padding: 7px 14px;\n   background: #000;\n   color: #fff;\n   text-transform: uppercase;\n   -webkit-box-shadow: 0 0 1px #000;\n   -moz-box-shadow: 0 0 1px #000;\n   box-shadow: 0 0 1px #000;\n}\n.view a.info: hover {\n   -webkit-box-shadow: 0 0 5px #000;\n   -moz-box-shadow: 0 0 5px #000;\n   box-shadow: 0 0 5px #000;\n}\n.view-fifth img {\n   -webkit-transition: all 0.3s ease-in-out;\n   -moz-transition: all 0.3s ease-in-out;\n   -o-transition: all 0.3s ease-in-out;\n   -ms-transition: all 0.3s ease-in-out;\n   transition: all 0.3s ease-in-out;\n}\n.view-fifth .mask {\n   background-color: rgba(146,96,91,0.3);\n   -webkit-transform: translateX(-300px);\n   -moz-transform: translateX(-300px);\n   -o-transform: translateX(-300px);\n   -ms-transform: translateX(-300px);\n   transform: translateX(-300px);\n   -ms-filter: \"progid: DXImageTransform.Microsoft.Alpha(Opacity=100)\";\n   filter: alpha(opacity=100);\n   opacity: 1;\n   -webkit-transition: all 0.3s ease-in-out;\n   -moz-transition: all 0.3s ease-in-out;\n   -o-transition: all 0.3s ease-in-out;\n   -ms-transition: all 0.3s ease-in-out;\n   transition: all 0.3s ease-in-out;\n}\n.view-fifth h2 {\n   background: rgba(255, 255, 255, 0.5);\n   color: #000;\n   -webkit-box-shadow: 0px 1px 3px rgba(159, 141, 140, 0.5);\n   -moz-box-shadow: 0px 1px 3px rgba(159, 141, 140, 0.5);\n   box-shadow: 0px 1px 3px rgba(159, 141, 140, 0.5);\n}\n.view-fifth p {\n   -ms-filter: \"progid: DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n   filter: alpha(opacity=0);\n   opacity: 0;\n   color: #333;\n   -webkit-transition: all 0.2s linear;\n   -moz-transition: all 0.2s linear;\n   -o-transition: all 0.2s linear;\n   -ms-transition: all 0.2s linear;\n   transition: all 0.2s linear;\n}\n.view-fifth:hover .mask {\n   -webkit-transform: translateX(0px);\n   -moz-transform: translateX(0px);\n   -o-transform: translateX(0px);\n   -ms-transform: translateX(0px);\n   transform: translateX(0px);\n}\n.view-fifth:hover img {\n   -webkit-transform: translateX(300px);\n   -moz-transform: translateX(300px);\n   -o-transform: translateX(300px);\n   -ms-transform: translateX(300px);\n   transform: translateX(300px);\n}\n.view-fifth:hover p {\n   -ms-filter: \"progid: DXImageTransform.Microsoft.Alpha(Opacity=100)\";\n   filter: alpha(opacity=100);\n   opacity: 1;\n}\n<\/style>\n<div style=\"margin: 20px auto; width: 330px\">\n<div class=\"view view-fifth\">\n\t\t\t<img decoding=\"async\" src=\"http:\/\/b.parsons.edu\/~dejongo\/12-fall\/stuff\/08_transition-1.jpg\" \/><\/p>\n<div class=\"mask\">\n<h2>Taiyo<\/h2>\n<p>Tompkins Square Park<\/p>\n<p>\t\t\t\t\t<a href=\"http:\/\/tympanus.net\/codrops\/2011\/11\/02\/original-hover-effects-with-css3\/\" class=\"in fo\">Tutorial<\/a>, <a href=\"http:\/\/tympanus.net\/Tutorials\/OriginalHoverEffects\/index5.html\" class=\"in fo\">Demo<\/a> and <a href=\"http:\/\/tympanus.net\/Tutorials\/OriginalHoverEffects\/OriginalHoverEffects.zip\" class=\"in fo\">Download<\/a>.\n\t\t\t<\/div>\n<\/p><\/div>\n<\/div>\n<h2>3D Transform<\/h2>\n<\/p>\n<p>Add to the X and Y axis a z axis, and you go from 2D to 3D. There are a number of additional <a href=\"http:\/\/www.w3.org\/TR\/css3-transforms\/#three-d-transform-functions\">3D functions<\/a> addressing the 3D space:<\/p>\n<ul style=\"list-style: none;\">\n<li><strong>matrix3d(number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number)<\/strong><br \/>\nMatrix 3D specifies a 3D transformation as a 4&#215;4 homogeneous matrix of 16 values in column-major order.\n<\/li>\n<li><strong>translate3d(value for x, value for y)<\/strong><br \/>\nTranslate 3D specifies a <a href=\"http:\/\/www.w3.org\/TR\/css3-transforms\/#Translate3dDefined\">3D translation<\/a> by the vector [tx,ty,tz], with tx, ty and tz being the first, second and third translation-value parameters respectively.\n<\/li>\n<li><strong>translateZ(value)<\/strong><br \/>\nTranslate Z specifies a <a href=\"http:\/\/www.w3.org\/TR\/css3-transforms\/#Translate3dDefined\">3D translation<\/a> by the vector [0,0,tz] with the given amount in the Z direction.\n<\/li>\n<li><strong>scale3d(value for x, value for y, value for z)<\/strong><br \/>\nScale 3D specifies a <a href=\"http:\/\/www.w3.org\/TR\/css3-transforms\/#Scale3dDefined\">3D scale<\/a> operation by the [sx,sy,sz] scaling vector described by the 3 parameters.\n<\/li>\n<li><strong>scaleZ(value)<\/strong><br \/>\nScale Z specifies a <a href=\"http:\/\/www.w3.org\/TR\/css3-transforms\/#Scale3dDefined\">3D scale<\/a> operation using the [1,1,sz] scaling vector, where sz is given as the parameter.\n<\/li>\n<li><strong>rotate3d(value for x, value for y, value for z, angle)<\/strong><br \/>\nRotate 3D specifies a <a href=\"http:\/\/www.w3.org\/TR\/css3-transforms\/#Rotate3dDefined\">3D rotation<\/a> by the angle specified in last parameter about the [x,y,z] direction vector described by the first three parameters. A direction vector that cannot be normalized, such as [0,0,0], will cause the rotation to not be applied. Note that the rotation is clockwise as one looks from the end of the vector toward the origin.<br \/>\n<strong>rotateX(angle)<\/strong> is the same as <strong>rotate3d(1, 0, 0, angle)<\/strong>.<br \/>\n<strong>rotateY(angle)<\/strong>  is the same as <strong>rotate3d(0, 1, 0, angle)<\/strong>. <br \/>\n<strong>rotateZ(angle)<\/strong> is the same as <strong>rotate3d(0, 0, 1, angle)<\/strong>, which is also the same as <strong>rotate(angle)<\/strong>.\n<\/li>\n<li><strong>perspective(value)<\/strong><br \/>\nPerspective specifies a <a href=\"http:\/\/www.w3.org\/TR\/css3-transforms\/#PerspectiveDefined\">perspective projection matrix<\/a>. This matrix scales points in X and Y based on their Z value, scaling points with positive Z values away from the origin, and those with negative Z values towards the origin. Points on the z=0 plane are unchanged. The parameter represents the distance of the z=0 plane from the viewer. Lower values give a more flattened pyramid and therefore a more pronounced perspective effect. For example, a value of 1000px gives a moderate amount of foreshortening and a value of 200px gives an extreme amount. The value for depth must be greater than zero, otherwise the function is invalid.<\/p>\n<p>Change the perspective on the example to 200 and see how extreme it becomes, or 500, which is much more normal. Change the rotation, and see the browser render the element as if it were in 3D space.\n<\/p>\n<\/li>\n<\/ul>\n<div class=\"handson_demo\">\n<h3>CSS Code View<\/h3>\n<pre>\r\n<style contenteditable=\"true\">\r\n#content {back ground: none;}\r\n\/*Make background transparent if demo becomes hidden below this element*\/\r\n#transform-3d {\r\nz-index: 1000;\r\nwidth: 200px;\r\nheight: 200px;\r\npadding: 20px;\r\noverflow: auto;\r\nmargin: auto;\r\nbackground-color: yellow;\r\n-webkit-transform-origin: top left;\r\n-webkit-transition: all 1s ease;\r\n-webkit-transform: perspective(305)\r\ntranslate3d(0px, 0px, 90px)\r\nscale3d(.7, .7, .7)\r\nrotate3d(51, 49, 60, 49deg);\r\n-webkit-transform-origin: 9% 51% 50%;\r\n-webkit-transform-style: preserve-3d;\r\n}<\/style><\/pre>\n<\/div>\n<div id=\"transform-3d\">\n<img decoding=\"async\" style=\"float: right; padding: 0 0 10px 10px; margin:0;\" src=\"http:\/\/b.parsons.edu\/~dejongo\/12-fall\/stuff\/07_CSS-border-image1.gif\" alt=\"border image\" \/><\/p>\n<p>The content (children) of the 3D transformed element inherit the altered coordinate space, and transform with it, such as this text and image.\n<\/p>\n<\/div>\n<p style=\"margin-top: 250px;\">Working in 3D is inherently complex and to do it right requires some calculation and knowledge of 3D. For a better primer check out <a href=\"http:\/\/www.eleqtriq.com\/2010\/05\/understanding-css-3d-transforms\/\">understanding CSS3D transforms<\/a> and <a href=\"http:\/\/www.eleqtriq.com\/2010\/11\/natural-object-rotation-with-css3-3d\/\">Natural Object Rotation in 3D<\/a> by Eleqtiq, who also gave us the CSS3 Text Warping  used above. For a  3D matrix transfom tool, check out the <a href=\"http:\/\/www.useragentman.com\/blog\/2015\/07\/16\/augment-photos-with-css3-matrix3d-transforms\/#more-7005\"> Matric Contruction Set<\/a> by Zoltan. That should get you started.<br \/>\n<iframe src=\"http:\/\/www.useragentman.com\/blog\/2015\/07\/16\/augment-photos-with-css3-matrix3d-transforms\/#more-7005\"  name=\"iframeDemo\"  style=\"width: 100%; height: 650px; border: 1px solid #f000; overflow: scroll;\" >You need a Frames Capable browser to view this content.<br \/>\n<\/iframe>\n<\/p>\n<p>In the mean time, more browsers are supporting transforms, so it looks like you can use it sooner than later, as long as your design falls back to something presentable on older browsers.\n<\/p>\n<p>Pong. Remember <a href=\"http:\/\/en.wikipedia.org\/wiki\/Pong\">Pong?<\/a> I&#8217;m sure that most of you only know it as a museum piece. It has been resurrected by Alex Walker as a strictly HTML and CSS3 (no javascript) <a href=\"http:\/\/www.sitepoint.com\/css3-pong-insane-things-to-do-with-css\/\">exercise<\/a> that works.\n<\/p>\n<p data-height=\"552\" data-theme-id=\"dark\" data-slug-hash=\"paHcG\" data-default-tab=\"result\" data-user=\"alexmwalker\" data-embed-version=\"2\" class=\"codepen\">See the Pen <a href=\"http:\/\/codepen.io\/alexmwalker\/pen\/paHcG\/\">CSS3 Pong<\/a> by Alex (<a href=\"http:\/\/codepen.io\/alexmwalker\">@alexmwalker<\/a>) on <a href=\"http:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"\/\/assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>Take a look at these <a href=\"http:\/\/css-3d.org\">3D animated demonstrations<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Visual Formatting Model Illustrator web coordinate system The web browser lays out the page according to a coordinate system that, by default, is expressed in pixels and has the X and Y Zero point in the upper left hand corner &hellip; <a href=\"https:\/\/b.parsons.edu\/~dejongo\/10-2d-transform\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[15],"tags":[],"_links":{"self":[{"href":"https:\/\/b.parsons.edu\/~dejongo\/wp-json\/wp\/v2\/posts\/466"}],"collection":[{"href":"https:\/\/b.parsons.edu\/~dejongo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/b.parsons.edu\/~dejongo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/b.parsons.edu\/~dejongo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/b.parsons.edu\/~dejongo\/wp-json\/wp\/v2\/comments?post=466"}],"version-history":[{"count":76,"href":"https:\/\/b.parsons.edu\/~dejongo\/wp-json\/wp\/v2\/posts\/466\/revisions"}],"predecessor-version":[{"id":4885,"href":"https:\/\/b.parsons.edu\/~dejongo\/wp-json\/wp\/v2\/posts\/466\/revisions\/4885"}],"wp:attachment":[{"href":"https:\/\/b.parsons.edu\/~dejongo\/wp-json\/wp\/v2\/media?parent=466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/b.parsons.edu\/~dejongo\/wp-json\/wp\/v2\/categories?post=466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/b.parsons.edu\/~dejongo\/wp-json\/wp\/v2\/tags?post=466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}