Basically, trying to do three transforms:
A) Rotate the icon to the right angle (Turn() to angle - easy part)
B) Stretch the icon out along the angle, anchoring it at the start-point (from mid-tile-A -> mid-tile-B) - we'll call this the x-dimension
C) Beginning at a 1-dimensional line (invisible), have it expand in the y-dimension so the beam gets thicker. (I might just do this in the icon's animation instead)
Here's what I got so far from testing, with some of it taken from other posts I found, the problem being that I don't fully understand what is being done.
BeamB(mob/M,turf/T)
var/dx = T.x-M.x
var/dy = T.y-M.y
var/ang = arctan(dx,dy)
var/hyp = sqrt(dx**2+dy**2)
var/obj/beam/B = new(M.loc)
B.pixel_x = dx/2*32
B.pixel_y = dy/2*32
var/newWidth = hyp
var/newX = (newWidth - 32)/2
B.transform = matrix().Turn(-ang)
var/matrix/m = matrix(hyp, 0, newX, 0, 1, 0) // I don't really know what these numbers do exactly
animate(B, transform = m, time = 20, flags = ANIMATION_LINEAR_TRANSFORM)