Jump to content

svg image position from bounding box value


gabdab
 Share

Recommended Posts

I would like to export to js a sort of skeletal animation made with inkscape.
Problem is how to extrapolate position and rotation from bounding box value .
I am able to find rotation from transform matrix .
I have some python code that doesn't work predictabily as for position of the image from bounding box value .
import mathimport sys#rotation : math.degrees(math.atan2(m2,m0)c = input('membro a della matrice: ')s = input('membro c della matrice: ')px = input('spostamento x: ')py = input('spostamento y: ')x = input(' x: ')y = input(' y: ')width = input(' w: ')hwidth = width/2height = input('h: ')hheight = height/2scale = input('scale: ')x1 = x -px + hwidthy1 = y -py  + hheightx2 = 1/scale*(c * x1) + 1/scale*(s * y1)print x2 + px - hwidth x1 = x + px + hwidthy1 = y + py  + hheighty2 = 1/scale*(-s * x1) + 1/scale*(c * y1)print y2 - py - hheight
 
 
 
 
This is the svg code :

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...