Maxim Sokhatsky 11 лет назад
Родитель
Сommit
8d16acb79a

+ 4 - 4
apps/face/priv/static/doc/Kakaranet-7-Refined.svg

@@ -721,14 +721,14 @@
         <g id="Create" sketch:type="MSLayerGroup" transform="translate(864.000000, 526.000000)">
             <path d="M86.71,58.24 C86.71,78.345 70.41,94.643 50.306,94.643 C30.201,94.643 13.903,78.345 13.903,58.24 C13.903,38.135 30.201,21.837 50.306,21.837 C70.411,21.837 86.71,38.135 86.71,58.24" id="Shape" fill="#517ECE" sketch:type="MSShapeGroup"></path>
             <path d="M65.668,55.841 L55.09,55.841 L55.09,45.263 C55.09,44.565 54.525,44 53.827,44 L48.104,44 C47.407,44 46.84,44.564 46.84,45.263 L46.84,55.841 L36.264,55.841 C35.567,55.841 35,56.407 35,57.106 L35,62.826 C35,63.525 35.566,64.091 36.264,64.091 L46.84,64.091 L46.84,74.666 C46.84,75.364 47.406,75.931 48.104,75.931 L53.827,75.931 C54.524,75.931 55.09,75.365 55.09,74.666 L55.09,64.091 L65.668,64.091 C66.366,64.091 66.931,63.526 66.931,62.826 L66.931,57.106 C66.931,56.408 66.367,55.841 65.668,55.841 L65.668,55.841 Z" id="Shape" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
-            <path d="M127,49 C127,49 63.4999983,-18.9227826 0,5.17094069" id="CreateMotion" sketch:type="MSShapeGroup"></path>
-            <path d="M13,5.80318006 C13,5.80318006 93.2315605,-20.7478933 129,51" id="CreateMotionBack" sketch:type="MSShapeGroup"></path>
+            <path d="M127,49 C127,49 63.4999983,-18.9227826 0,5.17094069" id="CreateShow" sketch:type="MSShapeGroup"></path>
+            <path d="M13,5.80318006 C13,5.80318006 93.2315605,-20.7478933 129,51" id="CreateHide" sketch:type="MSShapeGroup"></path>
         </g>
         <g id="Play" sketch:type="MSLayerGroup" transform="translate(946.000000, 461.000000)">
             <path d="M87.888,45.573 C87.888,65.678 71.588,81.975 51.484,81.975 C31.379,81.975 15.081,65.678 15.081,45.573 C15.081,25.468 31.379,9.169 51.484,9.169 C71.588,9.169 87.888,25.468 87.888,45.573" id="PlayButton" fill="#517ECE" sketch:type="MSShapeGroup"></path>
             <path d="M48.112,31.551 C47.494,31.102 46.675,31.036 45.998,31.384 C45.318,31.731 44.89,32.43 44.89,33.195 L44.89,57.707 C44.89,58.471 45.319,59.169 45.998,59.517 C46.288,59.664 46.604,59.739 46.92,59.739 C47.34,59.739 47.76,59.606 48.112,59.35 L64.987,47.093 C65.515,46.711 65.825,46.1 65.825,45.45 C65.825,44.799 65.513,44.188 64.987,43.807 L48.112,31.551 Z" id="PlayIcon" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
-            <path d="M48,116 C48,116 10.0374673,108.46934 1.9903702,66.370863 C-6.05672691,24.272386 12.8963039,2 12.8963039,2" id="PlayMotion" sketch:type="MSShapeGroup"></path>
-            <path d="M12,0 C12,0 1.1369324,32.7744489 12,69.1976755 C22.8630676,105.620902 46,114 46,114" id="PlayMotionBack" sketch:type="MSShapeGroup"></path>
+            <path d="M48,116 C48,116 10.0374673,108.46934 1.9903702,66.370863 C-6.05672691,24.272386 12.8963039,2 12.8963039,2" id="PlayShow" sketch:type="MSShapeGroup"></path>
+            <path d="M12,0 C12,0 1.1369324,32.7744489 12,69.1976755 C22.8630676,105.620902 46,114 46,114" id="PlayHide" sketch:type="MSShapeGroup"></path>
         </g>
         <g id="Promos" sketch:type="MSLayerGroup" transform="translate(132.000000, 577.000000)">
             <path d="M-0.297,36.711 C-0.297,56.975 16.129,73.4 36.392,73.4 C56.656,73.4 73.082,56.974 73.082,36.711 C73.082,16.448 56.655,0.021 36.392,0.021 C16.129,0.021 -0.297,16.447 -0.297,36.711" id="Shape" fill="#517ECE" sketch:type="MSShapeGroup"></path>

+ 36 - 24
apps/face/priv/static/doc/svg.js

@@ -83,6 +83,7 @@ function template_engine(html, data) {
 function reload(file, name) { var slot = document.getElementById(name);
          slot.parentNode.replaceChild(svg(localStorage.getItem(file)),slot);}
 
+
 function reload_cont(cont,name,element) { if (null != cont) (cont)(); else reload(name,element); }
 
 function loadFile(name,cont,element) {
@@ -95,7 +96,15 @@ function loadFile(name,cont,element) {
         client.send(); }
     else reload_cont(cont,name,element); }
 
-function svg(html) { return new DOMParser().parseFromString(html, "text/xml").firstChild; }
+function svg(html) {
+    return new DOMParser().parseFromString(html, "text/xml").firstChild;
+}
+
+function svgBulk() {
+    var res = [];
+    var node =  new DOMParser().parseFromString(html, "text/xml").firstChild;
+    for (var i=0;i<node.childnode.length;i++) { var child = childNodes.item(i);
+        if (child.tagName != undefined) res.push(child); } }
 
 // The Card
 
@@ -159,48 +168,51 @@ function findCardOnTable(c,v) {
     console.log("Card Not Found");
     return ""; }
 
+
+function loadAppend(file, animation, name) { 
+    loadFile(file, function() {
+        var slot = document.getElementById(name);
+        var r = template_engine(localStorage.getItem(file),{'name': animation});
+        document.getElementById(name).appendChild(svg(r)); }); }
+
+function loadAnimationForButton(a, b) { return loadAppend('templates/ButtonAnimation.svg', a, b); }
+
 // TODO: Rollout Monadic Chain here
 
 loadFile('templates/Card.svg', function() { 
     loadFile('Kakaranet-7-Refined.svg', function() {
+
         loadScene();
-        loadFile('templates/PlayShow.svg', function() {
-            document.getElementById("Play").appendChild(
-            svg(localStorage.getItem("templates/PlayShow.svg"))); 
-        });
-        loadFile('templates/PlayHide.svg', function() {
-            document.getElementById("Play").appendChild(
-            svg(localStorage.getItem("templates/PlayHide.svg"))); 
-        });
-        loadFile('templates/CreateShow.svg', function() {
-            document.getElementById("Create").appendChild(
-            svg(localStorage.getItem("templates/CreateShow.svg"))); 
-        });
-        loadFile('templates/CreateHide.svg', function() {
-            document.getElementById("Create").appendChild(
-            svg(localStorage.getItem("templates/CreateHide.svg"))); 
-        });
 
+        var a = [{button: "Create", pathes: ["CreateShow", "CreateHide"]},
+                 {button: "Play",   pathes: ["PlayShow",   "PlayHide"]}];
+
+        for (var y=0;y<a.length;y++) for (var x=0;x<a[y].pathes.length;x++)
+            loadAnimationForButton(a[y].pathes[x],a[y].button);
 
         document.getElementById("Right-Menu").setAttribute('onclick', 'onRightMenu(evt)');
-        document.getElementById("Play").setAttribute('onclick', 'onRightMenuDown(evt)');
-        document.getElementById("Create").setAttribute('onclick', 'onRightMenuDown(evt)');
+        document.getElementById("Play")      .setAttribute('onclick', 'onRightMenuDown(evt)');
+        document.getElementById("Create")    .setAttribute('onclick', 'onRightMenuDown(evt)');
 
     });
 });
 
-function onRightMenu(evt) { ["PlayShow","CreateShow"].map(function (x) { document.getElementById(x).beginElement(); }); }
-function onRightMenuDown(evt) { ["PlayHide","CreateHide"].map(function (x) { document.getElementById(x).beginElement(); }); }
+function onRightMenu(evt) {
+    ["PlayShow","CreateShow"].map(function (x) {
+        document.getElementById(x+"-Motion").beginElement(); }); }
 
+function onRightMenuDown(evt) {
+    ["PlayHide","CreateHide"].map(function (x) {
+        document.getElementById(x+"-Motion").beginElement(); }); }
 
 // SVG Samples for svg.htm
 
-loadFile('templates/Mustafa-Persona.svg', null, "Mustafa-Persona-Sample");
+loadFile('templates/Mustafa-Persona.svg',   null, "Mustafa-Persona-Sample");
 loadFile('templates/Mustafa-Selection.svg', null, "Mustafa-Selection-Sample");
 
-document.getElementById("MustafaSelection").addEventListener('click', function() { 
+document.getElementById("MustafaSelection").addEventListener('click', function() {
     var style = document.getElementById("Mustafa-Selection-Sample").style;
-    if (style.display == 'none') style.display = 'block'; 
+    if (style.display == 'none') style.display = 'block';
                             else style.display = 'none'; });
 
 function slotName1(x,y) { return "1Slot-"+y+","+x; }

+ 6 - 0
apps/face/priv/static/doc/templates/ButtonAnimation.svg

@@ -0,0 +1,6 @@
+
+ <animateMotion id="{this.name}-Motion" xmlns:xlink="http://www.w3.org/1999/xlink"
+  xmlns="http://www.w3.org/2000/svg" dur="0.2s" repeatCount="1" begin="indefinite">
+           <mpath xlink:href="#{this.name}"/>
+        </animateMotion>
+

+ 0 - 4
apps/face/priv/static/doc/templates/CreateHide.svg

@@ -1,4 +0,0 @@
- <animateMotion id="CreateHide" xmlns:xlink="http://www.w3.org/1999/xlink"
-  xmlns="http://www.w3.org/2000/svg" dur="0.2s" repeatCount="1" begin="indefinite">
-           <mpath xlink:href="#CreateMotionBack"/>
-        </animateMotion>

+ 0 - 4
apps/face/priv/static/doc/templates/CreateShow.svg

@@ -1,4 +0,0 @@
- <animateMotion id="CreateShow" xmlns:xlink="http://www.w3.org/1999/xlink"
-    xmlns="http://www.w3.org/2000/svg" dur="0.2s" repeatCount="1">
-           <mpath xlink:href="#CreateMotion"/>
-        </animateMotion>

+ 0 - 4
apps/face/priv/static/doc/templates/PlayHide.svg

@@ -1,4 +0,0 @@
- <animateMotion id="PlayHide" xmlns:xlink="http://www.w3.org/1999/xlink"
-  xmlns="http://www.w3.org/2000/svg" dur="0.2s" repeatCount="1" begin="indefinite">
-           <mpath xlink:href="#PlayMotionBack"/>
-        </animateMotion>

+ 0 - 4
apps/face/priv/static/doc/templates/PlayShow.svg

@@ -1,4 +0,0 @@
- <animateMotion id="PlayShow" xmlns:xlink="http://www.w3.org/1999/xlink"
-    xmlns="http://www.w3.org/2000/svg" dur="0.2s" repeatCount="1">
-           <mpath xlink:href="#PlayMotion"/>
-        </animateMotion>