2017-09-29 43 views
2

我有svg代碼,我需要在svg g tag變換中添加矩陣屬性。我已經添加了給定svg值的矩陣代碼屬性。實際上,我使用生成的svg值中的php自己重新創建svg元素。或者有沒有辦法計算出svg變換矩陣的屬性。如何將變換矩陣屬性添加到SVG文本?

我如何計算矩陣是(itemzoom_first_value + 1)和(itemzoom_second_value + 1)。

<svg> 
     <g id="0.601788739906624" transform="matrix(1.6636363636364 0 0 1.7414965986395 -6 372.3537414966)"> 
    <text fill="#000000" stroke="none" stroke-width="0" stroke-linecap="round" stroke-linejoin="round" x="0" y="0" text-anchor="left" font-size="90.75" font-family="Twine" data-textcurve="0" data-itemzoom="1 1" itemzoom="0.6636363636363637 0.7414965986394558">Hello 
    </text> 
    </g> 
<svg> 

回答

0
  • SVG不具有itemzoom財產
  • 唯一標識符的名稱不能以數字開頭。指定 以字母開頭的名稱,例如,id =「txt1」
  • 原點svg是左上角。要查看文本,您需要 「y」座標爲文本指定正值,大於 的字體大小。
  • 爲了提高文字的大小,則可以使用scale (2)命令 增大尺寸的兩倍,或任何其他值,例如:

    scale (1.2 1.5)由軸1.2倍和1.5增加的「X」軸「Y」

下面是更正你的SVG代碼

<svg > 
 
     <g id="txt1" > 
 
    <text y="60" fill="#000000" stroke="none" stroke-linecap="round" stroke-linejoin="round" text-anchor="left" font-size="90.75" font-family="Twine" >Hello </text> 
 
    </g> 
 
<svg>
徘徊在

<svg > 
 
     <g id="txt1" > 
 
    <text y="30" fill="#000000" stroke="none" stroke-linecap="round" stroke-linejoin="round" text-anchor="left" font-size="32" font-family="Twine" >Hello </text> 
 
    </g> 
 
\t <animateTransform xlink:href="#txt1" attributeName="transform" type="scale" dur="4s" begin="txt1.mouseover" end="txt1.mouseout" values="1;4;1" fill="freeze" restart="whenNotActive"/> 
 
<svg>

+1

是不是在尋找一種方式使用PHP的XML文件讀取OP動畫時,調整大小的文本的

例如,更改它,然後寫出來的是修改過的XML文件? –

+0

@RobertLongson你是對的。這是問題作者正在尋找的解決方案。我給出了另一個定位和修改文本大小的選項。也許這對某個人有用。 –