저는 같은 시간에 작은 사각형을 회전하려고합니다. 회전은 개별적입니다. 그래서 나는 둘 다 그룹으로 묶어서 동시에 회전시킬 수 없습니다.오프셋을 유지하는 평면으로 사각형을 회전합니다.
나는 배경 평면의 회전 각을 가지고있다. 캔버스 컨텍스트를 사용하지 않고 그냥 수학을 사용하고 싶습니다. 여기
내가 CX/CY 피벗입니다
var radians = Math.abs((Math.PI/180) * angle);
var cos = Math.cos(radians);
var sin = Math.sin(radians);
var newPoint = new Object();
newPoint.x = cos * (x-cx)-sin * (y-cy) + cx;
newPoint.y = sin * (x-cx)+cos * (y-cy) + cy;
을하려고 노력하는 것이다. 수학이 정확합니까 아니면 뭔가 빠졌습니까?
나는 자바 스크립트를 사용하지만, JS
내가 fig.a을 가지고 내가 아니라 모두가 그림에 표시되어 회전 할의 추상화를 확인하시기 바랍니다. (2) (3)는 사용자가 I이 서로 다른 접근 방법이 있습니다
#plane {
width: 400px;
height: 600px;
background: rgba(255,0,0,.3);
}
.wrapper {
position: relative;
}
#square {
position: absolute;
top: 60px;
left: 20px;
width: 40px;
height: 40px;
background: blue;
}
<div class="wrapper">
<!-- plane it can be a pdf, video, canvas or anything and I get the rotation angle -->
<div id="plane">Lorem ipsum text</div>
<!-- based on the angle of the plane I need to rotate and position this -->
<div id="square"></div>
</div>
당신은 HTML과 당신이 회전하려고하는 컨테이너의 CSS를 제공 할 수 있을까요? – azs06
나는 그것에게 포스트를 새롭게했다. 고맙습니다! –