Jump to content

svg image position from bounding box value


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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...