Toggle navigation
☰
HTML
CSS
Scripting
Database
<!DOCTYPE html> <title>My Example</title> <style> .atan2-container { /* Define Y and X coordinates */ --y: 100px; --x: -100px; background-color: #f8f9fa; border: 1px solid #dee2e6; padding: 40px; height: 200px; display: flex; align-items: center; justify-content: center; } .atan2-box { background-color: #6f42c1; color: white; font-family: sans-serif; font-weight: bold; display: flex; align-items: center; justify-content: center; text-align: center; width: 120px; height: 120px; border-radius: 8px; /* atan2(100px, -100px) equals 135deg. The box will rotate to face that coordinate. */ transform: rotate(atan2(var(--y), var(--x))); transition: transform 0.5s ease; } .atan2-box:hover { /* atan2(100px, 100px) equals 45deg */ transform: rotate(atan2(100px, 100px)); } </style> <div class="atan2-container"> <div class="atan2-box"> atan2(Y, X)<br> (135deg) </div> </div>