How do I define or reference a variable in SVG?

后端 未结 3 580
感情败类
感情败类 2021-01-04 01:38

Might be you do not need variables for static images but this would be easier to inspect them and see related parts when everything is defined in terms of variables, IMO. It

3条回答
  •  醉梦人生
    2021-01-04 01:46

    The SVG Parameter Variables Specification would do what you want but it's unlikely ever to be completed, let alone implemented by UAs. Instead SVG looks like it will move towards attributes being CSS parameters at which point you could use CSS Calc.

    There is a light at the end of the tunnel for you though as this specification is already implemented by a javascript shim so if you use that you have a ready made drop in library that does what you want.

    The syntax looks like this...

    
      
      
    
    

    or

    
    
    

    usage looks like this...

    
    
    
        
        
    
    
    
    

    The library can be obtained from here

提交回复
热议问题