-
-
Save zakdances/5849346 to your computer and use it in GitHub Desktop.
Matrix 3d transform for obtaining trapezoid? (SO)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Matrix 3d transform for obtaining trapezoid? (SO) | |
* http://stackoverflow.com/q/14480341/1397351 | |
*/ | |
* { | |
transform-style: preserve-3d; | |
} | |
.subject { | |
width: 100%; | |
height: 100%; | |
position: relative; | |
left: 0px; | |
top: 0; | |
margin-top: 0px; | |
} | |
.whatBox { | |
width: 340px; | |
height: 450px; | |
position: relative; | |
top: 30px; | |
left: 0; | |
margin: 0 auto; | |
background: #eee; | |
perspective: 1000px; | |
} | |
.what { | |
width: 130%; | |
height: 100%; | |
position: relative; | |
top: 0px; | |
opacity: .8; | |
transform-origin: 0% 0%; | |
transform: rotateX(98deg) | |
scaleY(.9) | |
translateZ(0px) translateX(-50px) | |
translateY(0px) skewx(0deg); | |
} | |
.img { | |
width: 100%; | |
height: 100%; | |
transform: scaleY(-1); | |
} | |
.img, .subject { | |
background: url('http://hdnaturepictures.com/wp-content/uploads/2013/05/Paradise-Place-Wallpaper.jpg'); | |
} | |
.target { mask: url(#m1); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- content to be placed inside <body>…</body> --> | |
<svg height="0"> | |
<mask id="m1" maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox"> | |
<radialGradient id="g2" gradientUnits="objectBoundingBox" x2="1" y2="0"> | |
<stop stop-color="white" stop-opacity="1" offset="0"/> | |
<stop stop-color="white" stop-opacity=".1" offset=".8"/> | |
<stop stop-color="white" stop-opacity="0" offset="1"/> | |
</radialGradient> | |
<!--<circle cx="0.25" cy="0.25" r="0.25" id="circle" fill="white"/>--> | |
<!--<rect x="0" y="0" width="1" height="1" fill="url(#g)"/>--> | |
<ellipse cx=".5" cy=".3" rx=".5" ry=".7" fill="url(#g2)"/> | |
</mask> | |
</svg> | |
<div class="whatBox"> | |
<div class="subject"></div> | |
<div class="what target"><div class="img"></div></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment