Skip to content

Instantly share code, notes, and snippets.

@jermenkoo
Created December 17, 2014 15:02
Show Gist options
  • Save jermenkoo/89d2227bc3196cca66c0 to your computer and use it in GitHub Desktop.
Save jermenkoo/89d2227bc3196cca66c0 to your computer and use it in GitHub Desktop.
from math import sin, cos, radians
t = int(input())
for i in range(t):
w, h, xt, yt, x0, y0, alpha, s = map(float, input().split())
a = alpha
alpha = radians(alpha)
x = -xt + w / 2
y = -yt + h / 2
x, y = cos(alpha) * (x) - sin(alpha) * (y), sin(alpha) * (x) + cos(alpha) * (y)
x *= s
y *= s
x = x + x0
y = y + y0
x = x - w * s / 2
y = y - h * s / 2
print(".item{} {{ width: {:.1f}px; height: {:.1f}px; left: {:.1f}px; top: {:.1f}px; transform: rotate({:.1f}deg); }}".format(i + 1, w * s, h * s, x, y, a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment