some text from MDN
The amount of rotation created by rotateY() is specified by an . If positive, the movement will be clockwise; if negative, it will be counter-clockwise.
const rotate1 = [
{
transform: `rotateX(0)`
},
{
transform: `rotateY(45deg)`
},
{
transform: `rotateX(0)`
}
];
const rotate2 = [
{
transform: `rotateY(0)`
},
{
transform: `rotateY(-45deg)`
},
{
transform: `rotateY(0)`
}
];
document.getElementById('rotated1').onclick = function(){this.animate(rotate1,1000)}
document.getElementById('rotated2').onclick = function(){this.animate(rotate2,1000)}
document.getElementById('rotated1').animate(rotate1,1000)
document.getElementById('rotated2').animate(rotate2,1000)
div {
width: 180px;
height: 180px;
}
#rotated1 {
background-color: pink;
}
#rotated2 {
background-color: green;
}
<div id="rotated1">click me</div>
<div id="rotated2">click me</div>
pls have a look on this demo
it makes me confused..
what i expect is : http://img.htmleaf.com/1610/rotateY-demo.jpg