1<?xml version="1.0" standalone="no"?>
2<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
4<!--
5  Copyright (C) 2010 University of Szeged
6  Copyright (C) 2010 Zoltan Herczeg
7  Copyright (C) 2010 Gabor Loki
8  All rights reserved.
9
10  Redistribution and use in source and binary forms, with or without
11  modification, are permitted provided that the following conditions
12  are met:
13  1. Redistributions of source code must retain the above copyright
14     notice, this list of conditions and the following disclaimer.
15  2. Redistributions in binary form must reproduce the above copyright
16     notice, this list of conditions and the following disclaimer in the
17     documentation and/or other materials provided with the distribution.
18
19  THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
20  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
23  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27  OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30-->
31
32<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
33<rect x="0%" y="0%" width="100%" height="100%" fill="black" />
34
35<defs>
36<filter id="filt" filterUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
37    <feTurbulence baseFrequency="0.03" numOctaves="4" seed="67" result="turb"/>
38    <feGaussianBlur in="SourceGraphic" primitiveUnits="objectBoundingBox" stdDeviation="1" result="blur"/>
39    <feComposite in="turb" in2="blur" operator="arithmetic" k2="0.3" k3="1" result="comp"/>
40    <feDiffuseLighting in="comp" primitiveUnits="objectBoundingBox" diffuseConstant="1" lighting-color="white" surfaceScale="10" result="light" >
41        <feSpotLight id="light" x="0" y="300" z="200" pointsAtX="-200" pointsAtY="100" pointsAtZ="0" limitingConeAngle="90" specularExponent="20" />
42    </feDiffuseLighting>
43    <feSpecularLighting in="comp" primitiveUnits="objectBoundingBox" diffuseConstant="1" lighting-color="#A66102" surfaceScale="10" result="ambient" >
44        <feDistantLight azimuth="0" elevation="90" />
45    </feSpecularLighting>
46    <feComposite in="light" in2="ambient" operator="arithmetic" k2="1.2" k3=".8"/>
47</filter>
48</defs>
49
50<g filter="url(#filt)" fill="white" stroke="black" onclick="start()">
51    <rect x="0" y="0" width="400" height="5" />
52    <rect x="0" y="0" width="5" height="200" />
53    <rect x="0" y="195" width="400" height="5" />
54    <rect x="395" y="0" width="5" height="200" />
55    <text font-size="150" font-weight="bold" x="40" y="150">SVG</text>
56</g>
57
58<text id="fps" x="150" y="240" font-size="20" fill="white" stroke="white">afps:</text>
59<text x="30" y="265" font-size="20" font-weight="bold" fill="white" stroke="white">click on the image to start the animation</text>
60
61<script>
62<![CDATA[
63var light_x = document.getElementById('light').x;
64var light_y = document.getElementById('light').y;
65var light_pointsAtX = document.getElementById('light').pointsAtX;
66var light_pointsAtY = document.getElementById('light').pointsAtY;
67var fps = document.getElementById('fps');
68
69var round = Math.round
70
71var startDate = 0;
72var frameCounter = 0;
73var phase = 0;
74function anim() {
75    switch(phase) {
76    case 0:
77        light_pointsAtX.baseVal += 10;
78        if (light_pointsAtX.baseVal >= 380)
79            ++phase;
80        break;
81    case 1:
82        light_x.baseVal += 10;
83        light_pointsAtX.baseVal -= 10;
84        if (light_x.baseVal >= 450) {
85            ++phase;
86            waitCounter = 0;
87        }
88        break;
89    case 2:
90        light_y.baseVal -= 5;
91        if (light_y.baseVal <= -100)
92            ++phase;
93        break;
94    case 3:
95        light_pointsAtX.baseVal += 10;
96        if (light_pointsAtX.baseVal >= 450) {
97            light_x.baseVal = 0;
98            light_pointsAtX.baseVal = -200;
99            light_y.baseVal = 300;
100            light_pointsAtY.baseVal = 100;
101            phase = 0;
102        }
103        break;
104    }
105
106    frameCounter++;
107    fps.textContent = "afps: " +(round(frameCounter * 100000 / (new Date() - startDate)) / 100);
108}
109
110function start() {
111    if (!startDate) {
112        startDate = new Date();
113        setInterval(anim,1);
114    }
115}
116
117//]]>
118</script>
119
120</svg>
121