Comment by tgtweak
1 day ago
This actually looks surprisingly straightforward for what the function is doing - certainly if you have domain context of image editing or document placement. You'll find it in a lot of UI code - this one uses bit shifts for efficiency but what it's doing is pretty straightforward.
For clarity and to demonstrate, this is basically what this function is doing, but in css:
.container {
position: relative;
}
.obj {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
No comments yet
Contribute on Hacker News ↗