Quantcast
Viewing all articles
Browse latest Browse all 152999

Re: SVG Manipulation

If you declare the function like above within compositionReady event handler, the function remains local to the event handler function.

 

To use outside, you need to declare it like this:

     this.CreateSvg = function(y1,y2,y3,y4,y5,y6,y7,y8,y9){

          var sim = sym.$("Stage");

          var sVg = ( '<svg height="100" width="500"> <polygon id="box1" fill="#D04E00" points="500,253.327 43.6,253.327 43.6,'+y1+' 90.128,'+y1+' 136.691,'+y3+'                                183.254,'+y4+'229.783,'+y5+' 276.346,'+y6+' 322.909,'+y7+' 369.437,'+y8+' 500,'+y9+' "/>')

 

          sim.append(sym.$(sVg).css());

     }

 

now this function becomes an attribute to the "Stage" symbol, and now you need to call it like:

     sym.CreateSvg(90,80,40,30,20,20,30,0,12)

 

hth,

Vivekuma


Viewing all articles
Browse latest Browse all 152999

Trending Articles