Created
          February 8, 2012 22:00 
        
      - 
      
 - 
        
Save sebmarkbage/1774317 to your computer and use it in GitHub Desktop.  
    Parse CSS Transform with ART
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function parseCSStransform(transform){ | |
| var result = new ART.Transform(), tranform, | |
| commandMatcher = /(\w+)\(([^\)]*)\)/g, command, | |
| paramMatcher = /([\d\.]+)/g, params; | |
| while (command = commandMatcher.exec(transform)){ | |
| params = command[2].match(paramMatcher); | |
| for (var i = 0; i < params.length; i++) | |
| params[i] = parseFloat(params[i]); | |
| transform = new ART.Transform(); | |
| transform[command[1]].apply(transform, params); | |
| result.transform(transform); | |
| } | |
| return result; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment