void transform(Element el, { Vector2 position, Vector2 rotation, Vector2 scale })

Updates the transform on el using optional Vectors. This function prevents seperate manual transform updates, that either update rotatiom, position or scale to override each other.

Source

void transform(Element el, { Vector2 position, Vector2 rotation, Vector2 scale })
{
    var transformation = "";

    if (position != null)
    {
        el.attributes["position"] = "translate(${position.x.round()}px, ${position.y.round()}px)";
    }

    if (rotation != null)
    {
        final radians = atan2(rotation.x, rotation.y);
        el.attributes["rotation"] = "rotate(${radians}rad)";
    }

    if (scale != null)
    {
        el.attributes["scale"] = "scale(${scale.x}, ${scale.y})";
    }

    if ( el.attributes.containsKey("position")  ) transformation += el.attributes["position"] + " ";
    if ( el.attributes.containsKey("rotation")  ) transformation += el.attributes["rotation"] + " ";
    if ( el.attributes.containsKey("scale")  )    transformation += el.attributes["scale"] + " ";

    el.style.transform = transformation;
}