Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
set(frame, baseFrame, rotate)
{
const tw = baseFrame.width;
const th = baseFrame.height;
if (rotate)
{
// width and height div 2 div baseFrame size
const w2 = frame.width / 2 / tw;
const h2 = frame.height / 2 / th;
// coordinates of center
const cX = (frame.x / tw) + w2;
const cY = (frame.y / th) + h2;
rotate = GroupD8.add(rotate, GroupD8.NW); // NW is top-left corner
this.x0 = cX + (w2 * GroupD8.uX(rotate));
this.y0 = cY + (h2 * GroupD8.uY(rotate));
rotate = GroupD8.add(rotate, 2); // rotate 90 degrees clockwise
this.x1 = cX + (w2 * GroupD8.uX(rotate));
this.y1 = cY + (h2 * GroupD8.uY(rotate));
rotate = GroupD8.add(rotate, 2);
this.x2 = cX + (w2 * GroupD8.uX(rotate));
this.y2 = cY + (h2 * GroupD8.uY(rotate));
rotate = GroupD8.add(rotate, 2);
this.x3 = cX + (w2 * GroupD8.uX(rotate));
this.y3 = cY + (h2 * GroupD8.uY(rotate));
}
else