you can also use the .multiply method of the transform type, here is a small example of the fractal furn that uses the transforms of elements to store transforms, them concat them, and use the x, y offset to plot points. so, I think the answer is yes! John <?xml version="1.0" ?> <svg viewBox = "-500 -500 1000 1000" onload="init();"> <title>IFS Fractal Fern</title> <g id = "background" onload="init()"> <text transform="matrix(3.0188 0 0 2 392 370)" onclick=" repeat++;loop();">SVG Fractal Fern</text> <g id="f0" onclick=" repeat++;loop()" transform="matrix(0.85 -0.042 0.04 0.85 0 1.6)"><text> Fern3</text> </g> <!-- p(0) = 0.82 --> <g id="f1" onclick=" repeat++;loop();;" transform="matrix(0.0001 0 0 0.16 0 0)"><text> Fern1</text> </g> <!-- p(1) = 0.01 --> <g id="f2" transform="matrix(0.2 0.23 -0.26 0.22 0 0.2)"><text> Fern2</text> </g><!-- p(2) = 0.07 --> <g id="f3" transform="matrix(-0.15 0.26 0.28 0.24 0 0.2)"><text> Fern3</text></g> <!-- p(3) = 0.07 --> </g> <script ><![CDATA[ var item; var repeat = 50; var fa=svgDocument.getElementById("f0"); var fb=svgDocument.getElementById("f1"); var fc=svgDocument.getElementById("f2"); var fd=svgDocument.getElementById("f3"); var colorShift = "fill: blue"; var LetterR = fa.getCTM(); var LetterS = fb.getCTM(); function init(){ loop(); setTimeout("loop()",1000); } // end of function function loop(){ var Color; var CTM = fa.getCTM(); var m1 = fa.getCTM(); var CVM = fa.getCTM(); for( var i = 1; i <1520; i++ ) { p = Math.random(); if (p < 0.710){ m1 = fa.getCTM(); Color = "fill: blue";} else if (p < 0.720) {m1 = fb.getCTM(); Color = "fill: cyan";} else if (p < 0.780){ m1 = fc.getCTM(); Color = "fill: red";} else if (p < 0.880) {m1 = fd.getCTM(); Color = "fill: green";} CTM = m1.multiply(CTM); if((i > 10) || (repeat > 10)) { item = makeDOMElement(CTM,svgDocument,colorShift); colorShift = Color; fa.appendChild(item); } } // endof loop repeat = repeat - 1; if(repeat > 0) setTimeout("loop()",1000); } function makeDOMElement(CTM,d,Color) { var insertItem; var insertItem1; var y=CTM.e * 230 ; var x=(CTM.f * -120) ; //insertItem = d.createElement("g" ); insertItem = d.createElement("path" ); insertItem.setAttribute("d","M " + x +" "+ y +" L " + (x+4) +" "+ (y+4) +" z"); return insertItem; } ]]> </script > </svg>
[EMAIL PROTECTED] wrote: Hi Lance, svg-developers@yahoogroups.com wrote on 05/12/2006 04:48:32 PM: > My example was incomplete. I wanted to transform and then draw many > graphic primitives, not just one, and without groups because of the > nesting issue. Well you can include the set of primitive to draw in a group (but not nest). This does add 2 char over the 'set' case but that isn't bad ;) <set transform=""/>[your primitives] <g transform="" >[your primitives]</g> > I agree with you about the userspace (scope) issue and > resetting midstream, but it would be handy (for me) and there is a > sequence to the commands which would answer that. Anyways, your > comments sound good. thanks! I have reworked our parser for the way > you suggest. Good luck. > > thanks!- > > -lance > > > On May 12, 2006, at 1:32 PM, [EMAIL PROTECTED] wrote: > > > Hi Lance, > > > > svg-developers@yahoogroups.com wrote on 05/11/2006 02:03:58 PM: > > > >>> you can combine like this > >>> <rect style="transform="translate(8,48)" .... X1 xxx> > > > >> However, it also makes for a lot of redundant attributes, or deeply > >> nested groups. I don't like that, but I guess there is no way around > >> that at this time? > > > > I don't see any "extra" redundancy SVG's way: > > > > <g ....> > > <rect transform="translate(1,1)" ...> > > <rect transform="translate(2,2)" ...> > > </g> > > > > Your way: > > > > <g ....> > > <set transform="translate(1,1)"/> > > <rect ...> > > <set transform="translate(2,2)"/> > > <rect ...> > > </g> > > > > It looks to me like your way has this extra "wasted" 'set' element. > > > >> to reset the attribute at the time of processing; and even make the > >> set implicit to g="current" so I don't have to refer to it as that is > >> the deepest context anyways. Otherwise, svg gets verbose and > >> redundant. > > > > I beg to differ, I'll admit that trying to nest your g elements > > isn't > > that nice, but just setting the transform on the rects is very concise > > and avoids a lot of issues like just what is the userspace of the g > > if you can change it in the middle of the children list... > > > > > > > > ----- > 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 unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- --------------------------------- YAHOO! GROUPS LINKS Visit your group "svg-developers" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- --------------------------------- Get amazing travel prices for air and hotel in one click on Yahoo! FareChase [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Get to your groups with one click. Know instantly when new email arrives http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/1U_rlB/TM --------------------------------------------------------------------~-> ----- 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/