Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- deg = 0;
- setInterval(()=>{
- deg+=1;
- document.getElementById("div1").style.transform = `rotate(${deg}deg)`;
- },20);
- #div1{
- transform-origin:50% 50%;
- width: 200px;
- height: 400px;
- }
- x0 = -width / 2
- y0 = height / 2 //знак зависит от направления осей
- x = x0 * Cos(angle) - y0 * Sin(angle) =
- -width / 2 * Cos(angle) - height / 2 * Sin(angle)
- y = x0 * Sin(angle) + y0 * Cos(angle) =
- -width / 2 * Sin(angle) + height / 2 * Cos(angle)
Add Comment
Please, Sign In to add comment