| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright (c) 2012 Cameron Adams. All rights reserved. | 2 Copyright (c) 2012 Cameron Adams. All rights reserved. |
| 3 Copyright (c) 2012 Code Aurora Forum. All rights reserved. | 3 Copyright (c) 2012 Code Aurora Forum. All rights reserved. |
| 4 Copyright (C) 2013 Google Inc. All rights reserved. | 4 Copyright (C) 2013 Google Inc. All rights reserved. |
| 5 | 5 |
| 6 Redistribution and use in source and binary forms, with or without | 6 Redistribution and use in source and binary forms, with or without |
| 7 modification, are permitted provided that the following conditions are | 7 modification, are permitted provided that the following conditions are |
| 8 met: | 8 met: |
| 9 * Redistributions of source code must retain the above copyright | 9 * Redistributions of source code must retain the above copyright |
| 10 notice, this list of conditions and the following disclaimer. | 10 notice, this list of conditions and the following disclaimer. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 var particles = []; | 70 var particles = []; |
| 71 | 71 |
| 72 window.onload = function () { | 72 window.onload = function () { |
| 73 svgContainer.setAttribute('width', stageWidth); | 73 svgContainer.setAttribute('width', stageWidth); |
| 74 svgContainer.setAttribute('height', stageHeight); | 74 svgContainer.setAttribute('height', stageHeight); |
| 75 | 75 |
| 76 for (var i = 0; i < maxParticles; i++) | 76 for (var i = 0; i < maxParticles; i++) |
| 77 addParticle(); | 77 addParticle(); |
| 78 | 78 |
| 79 PerfTestRunner.prepareToMeasureValuesAsync({done: onCompletedRun, unit: 'fps
'}); | 79 PerfTestRunner.prepareToMeasureValuesAsync({ |
| 80 description: 'Measures performance of SVG animation using animateTransfo
rm (animating on x and y).', |
| 81 done: onCompletedRun, |
| 82 unit: 'fps' |
| 83 }); |
| 80 | 84 |
| 81 startTrackingFrameRate(); | 85 startTrackingFrameRate(); |
| 82 } | 86 } |
| 83 | 87 |
| 84 function addParticle() | 88 function addParticle() |
| 85 { | 89 { |
| 86 var circle = document.createElementNS('http://www.w3.org/2000/svg','circle')
; | 90 var circle = document.createElementNS('http://www.w3.org/2000/svg','circle')
; |
| 87 circle.setAttribute('r', particleRadius); | 91 circle.setAttribute('r', particleRadius); |
| 88 circle.setAttribute('fill', colors[Math.floor(Math.random() * colors.length)
]); | 92 circle.setAttribute('fill', colors[Math.floor(Math.random() * colors.length)
]); |
| 89 addAnimation(circle); | 93 addAnimation(circle); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 164 |
| 161 | 165 |
| 162 function onCompletedRun() { | 166 function onCompletedRun() { |
| 163 stopTrackingFrameRate(); | 167 stopTrackingFrameRate(); |
| 164 svgContainer.remove(); | 168 svgContainer.remove(); |
| 165 } | 169 } |
| 166 </script> | 170 </script> |
| 167 </head> | 171 </head> |
| 168 <svg ns="http://www.w3.org/2000/svg" version="1.1" id="svgContainer"></svg> | 172 <svg ns="http://www.w3.org/2000/svg" version="1.1" id="svgContainer"></svg> |
| 169 </html> | 173 </html> |
| OLD | NEW |