example/js/svg.js
function() {
      // find delta transform points
      var px    = deltaTransformPoint(this, 0, 1)
        , py    = deltaTransformPoint(this, 1, 0)
        , skewX = 180 / Math.PI * Math.atan2(px.y, px.x) - 90

      return {
        // translation
        x:        this.e
      , y:        this.f
      , transformedX:(this.e * Math.cos(skewX * Math.PI / 180) + this.f * Math.sin(skewX * Math.PI / 180)) / Math.sqrt(this.a * this.a + this.b * this.b)
      , transformedY:(this.f * Math.cos(skewX * Math.PI / 180) + this.e * Math.sin(-skewX * Math.PI / 180)) / Math.sqrt(this.c * this.c + this.d * this.d)
        // skew
      , skewX:    -skewX
      , skewY:    180 / Math.PI * Math.atan2(py.y, py.x)
        // scale
      , scaleX:   Math.sqrt(this.a * this.a + this.b * this.b)
      , scaleY:   Math.sqrt(this.c * this.c + this.d * this.d)
        // rotation
      , rotation: skewX
      , a: this.a
      , b: this.b
      , c: this.c
      , d: this.d
      , e: this.e
      , f: this.f
      , matrix: new SVG.Matrix(this)
      }
    }
function() {
      // find delta transform points
      var px    = deltaTransformPoint(this, 0, 1)
        , py    = deltaTransformPoint(this, 1, 0)
        , skewX = 180 / Math.PI * Math.atan2(px.y, px.x) - 90

      return {
        // translation
        x:        this.e
      , y:        this.f
      , transformedX:(this.e * Math.cos(skewX * Math.PI / 180) + this.f * Math.sin(skewX * Math.PI / 180)) / Math.sqrt(this.a * this.a + this.b * this.b)
      , transformedY:(this.f * Math.cos(skewX * Math.PI / 180) + this.e * Math.sin(-skewX * Math.PI / 180)) / Math.sqrt(this.c * this.c + this.d * this.d)
        // skew
      , skewX:    -skewX
      , skewY:    180 / Math.PI * Math.atan2(py.y, py.x)
        // scale
      , scaleX:   Math.sqrt(this.a * this.a + this.b * this.b)
      , scaleY:   Math.sqrt(this.c * this.c + this.d * this.d)
        // rotation
      , rotation: skewX
      , a: this.a
      , b: this.b
      , c: this.c
      , d: this.d
      , e: this.e
      , f: this.f
      , matrix: new SVG.Matrix(this)
      }
    }
function ( ) { // find delta transform points var px = deltaTransformPoint ( this , 0 , 1 ) , py = deltaTransformPoint ( this , 1 , 0 ) , skewX = 180 / Math . PI * Math . atan2 ( px . y , px . x ) - 90 return { // translation x : this . e , y : this . f , transformedX : ( this . e * Math . cos ( skewX * Math . PI / 180 ) + this . f * Math . sin ( skewX * Math . PI / 180 ) ) / Math . sqrt ( this . a * this . a + this . b * this . b ) , transformedY : ( this . f * Math . cos ( skewX * Math . PI / 180 ) + this . e * Math . sin ( - skewX * Math . PI / 180 ) ) / Math . sqrt ( this . c * this . c + this . d * this . d ) // skew , skewX : - skewX , skewY : 180 / Math . PI * Math . atan2 ( py . y , py . x ) // scale , scaleX : Math . sqrt ( this . a * this . a + this . b * this . b ) , scaleY : Math . sqrt ( this . c * this . c + this . d * this . d ) // rotation , rotation : skewX , a : this . a , b : this . b , c : this . c , d : this . d , e : this . e , f : this . f , matrix : new SVG . Matrix ( this ) } }
Extract individual transformations
Extract individual transformations