Inkscape.org
Beginners' Questions Attribute Transform with matrix stretch the object during rotation
  1. #1
    InkscapeNewbie2025 InkscapeNewbie2025 @InkscapeNewbie2025
    rotate=$'parent.name'.OutPositionRel;
    
    beginUpdate=function(){
    
    var matrix;
    var angelGrad;
    var angleRad;
    var pi;
    var a;
    var b;
    var c;
    var d;
    var tx;
    var ty;
    
    angleGrad=this.rotate / 100 * 45;
    pi=3.14159265358979;
    angleRad=(angleGrad  *  pi / 90);
    
    a=Math.cos(angleRad);
    b=Math.sin(angleRad);
    c=-Math.sin(angleRad);
    d=Math.cos(angleRad);
    tx=(-1 * a) + 1 ;
    ty=(-1 * b) ;
    
    matrix="matrix(" +  a + "," + b + "," + c + "," + d + "," + tx + "," + ty +")"; 
    
    this._dynShape.setAttribute("transform" , matrix);
    
    };

    Hello community,

    i'm strugle with one point in Inkscape (Version 0.48 on Windows 10). I'm using following code (see above) to rotate one object, but after rotation my object get stretched and don't keep original size. What i will do is very simple. I get from parant object via tag OutPositionRel input 0-100, and rotate my object 0°-90°.
    What i allrady did:
    - ask ChatGPT, don't get realy good  answer/ solution, just the same formula, like i allrady have

    - Used google search and lot of forums

    I would appreciate any suggestions or ideas.

     

     

     

     

    Input 100 Endposition
    Input 0 Start Position
  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    Since no responses yet, I suggest asking on the chat: https://chat.inkscape.org/channel/inkscape_user.  More developers are there.

  3. #3
    InkscapeNewbie2025 InkscapeNewbie2025 @InkscapeNewbie2025

    ok, thx

Inkscape Inkscape.org Inkscape Forum Beginners' Questions Attribute Transform with matrix stretch the object during rotation