4

I was going to answer a question tagged JQuery which got closed(off-topic).I created a fiddle to answer it. It is working just as I wanted it to, but the rotated divs do not look as I wanted them to.

It looks like >

enter image description here

Instead of this >

enter image description here

I am using perspective and rotateY for the rotate effect I have achieved till now. I just need help in CSS for this.

Zword
  • 6,605
  • 3
  • 27
  • 52
  • i think same question [css3-transform][1] [1]: http://stackoverflow.com/questions/5293736/css3-transform-skew – CY5 Dec 26 '13 at 15:47

4 Answers4

7

You need to modify the transform-origin point, try this:

-webkit-transform-origin: 0 0;
-webkit-transform-origin: 100% 0;

See this fiddle: The demo http://jsfiddle.net/kzQFQ/185/

Zword
  • 6,605
  • 3
  • 27
  • 52
DaniP
  • 37,813
  • 8
  • 65
  • 74
  • 1
    Thaks @Zword for edit the fiddle to make both work i was without time to make the full answer :P – DaniP Dec 26 '13 at 16:58
2

Your containers are not large enough for the perspective'd and rotated div. Consequently it gets chopped off. (Margins are also needed on the content-container to scoot them down)

.wrapper {
position: relative;
width: auto;
margin-top:40px;
height: 600px;
top: 0;
left: 0;
overflow: hidden;
perspective: 800px;
-moz-perspective: 800px;
-webkit-perspective: 800px;
-webkit-perspective-origin: 50% 100px;
}

http://jsfiddle.net/fgM49/

VoronoiPotato
  • 3,113
  • 20
  • 30
2

for left div

-webkit-transform: perspective(100px) rotateY(30deg);

for right div

-webkit-transform: perspective(100px) rotateY(-30deg);

for crossbrowser support you can use http://ricostacruz.com/jquery.transit/

$('').transition({
  perspective: '100px',
  rotateY: '30deg'
});
animack
  • 67
  • 1
  • 5
2

Just add scaleY(0.94) like

-webkit-transform: rotateY(30deg) rotateY(30deg);

Here is the demo http://jsfiddle.net/kzQFQ/190/

Nikola Nikolić
  • 356
  • 2
  • 17