import { m3_cm_compose_transform } from "../core/geom/mat3/m3_cm_compose_transform.js";
import { writeCssTransformMatrix } from "./writeCssTransformMatrix.js";

const scratch_m3_0 = new Float32Array(9);

/**
 * @see https://dev.opera.com/articles/understanding-the-css-transforms-matrix/
 * @param domElement
 * @param {Vector2} position
 * @param {Vector2} scale
 * @param {number} rotation angle in radians
 */
function setElementTransform(domElement, position, scale, rotation) {

    const m3 = scratch_m3_0;

    m3_cm_compose_transform(m3, position.x, position.y, scale.x, scale.y, 0, 0, rotation);

    writeCssTransformMatrix(m3, domElement);
}