When I click on the scene, then box falls down. When I click again, box stands up. Animation is smooth, but when I click many times in different positions, then sometimes animation skips frames.
I have this bug on OS X in Google Chrome. Tested in Opera — everything is ok, there is no bug.
http://jsfiddle.net/nw78myhn/1/
Does anybody know how to fix the problem?
<div class="scene">
<div class="box"></div>
</div>
.scene {
width: 500px;
height: 500px;
position: absolute;
background: #efefef;
}
.box {
position: absolute;
left: 250px;
top: 100px;
width: 70px;
height: 140px;
background: #000;
transform: rotate(0deg);
transform-origin: bottom left;
transition: transform 600ms linear;
}
.box-transform {
transform: rotate(-96deg);
}
$('.scene').on('click', function() {
$('.box').toggleClass('box-transform');
});
UPDATE:
I've noticed that there is no frame skipping if transform-origin
is set for .box-transform
instead of .box
:
http://jsfiddle.net/nw78myhn/2/
But in this case origin is not visually at bottom left
. And I don't really understand why.
UPDATE 2 [16 February 2016]:
This bug was fixed in newer versions of Google Chrome. Can't reproduce in Chrome 48.0.2564.109
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…