Hi achio,
I believe that you can use transform (matrix). The matrix command allows you
to combine all transform commands on a single line. Read about it here:
http://www.w3.org/TR/SVG/coords.html#TransformAttribute
<http://www.w3.org/TR/SVG/coords.html#TransformAttribute>  
:-) 

-----Original Message-----
From: svg-developers@yahoogroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Doug Schepers
Sent: Thursday, 27 July 2006 12:32 PM
To: svg-developers@yahoogroups.com
Subject: RE: [svg-developers] problem regarding transform



Hi, achio-

achio_84 wrote:
| 
| Hi all...
| I would like to ask whether it is possible to combine 
| transform (scale) 
| and transform (translate) in 1 javascript statement? 
| For example:
| 
| shape1.setAttributeNS(null,"transform","scale("+scaleLevel+")");
| shape1.setAttributeNS(null,"transform","translate
| ("+positionx+","+positiony+")");
| 
| Is there a way to combine both statement stated above to become 1 
| statement? Coz after I scale the shape, and translate it, the scale 
| change to it default value again... I don't know why....

An attribute value is a string, not a function. Thus, in order to have both
transformations active, you must concatenate them. 

shape1.setAttributeNS(null, "transform","scale("+scaleLevel+")
translate("+positionx+","+positiony+")");

or, to make it a little more managable 

var transformStr = "scale("+scaleLevel+")
translate("+positionx+","+positiony+")";
shape1.setAttributeNS(null, "transform", transformStr);

These will both end up as e.g.:
<circle cx="5" cy="55" r="20" transform="scale(2) translate(100,30)" />

Note that you will get different results depending on the order of these
transform commands. If translate is after scale, you will multiply the
parameters of translate by the parameters of the scale (e.g. in the above
example, it would be the equivalent of doubling the translate parameters, or
the same as saying transform="translate(200,60) scale(2)").

Regards-
Doug



 



Australia Post is committed to providing our customers with excellent service. 
If we can assist you in any way please telephone 13 13 18 or visit our website.

The information contained in this e-mail communication may be proprietary, 
confidential or legally professionally privileged.  It is intended exclusively 
for the individual or entity to which it is addressed. You should only read, 
disclose, re-transmit, copy, distribute, act in reliance on or commercialise 
the information if you are authorised to do so. Australia Post does not 
represent, warrant or guarantee the integrity of this e-mail communication has 
been maintained nor that the communication is free of errors, virus or 
interference. 

If you are not the addressee or intended recipient please notify us by replying 
direct to the sender and then destroy any electronic or paper copy of this 
message. Any views expressed in this e-mail communication are taken to be those 
of the individual sender, except where the sender specifically attributes those 
views to Australia Post and is authorised to do so.

[Non-text portions of this message have been removed]



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to