From 5206de3fc875c89821ab9e74640feb08772818d0 Mon Sep 17 00:00:00 2001 From: masayuki iizuka Date: Wed, 12 Apr 2017 11:49:31 +0900 Subject: [PATCH] render when autoplay=false --- .../ExtensionContent/SnapSVGAnimator/js/SnapSVGAnimator.js | 2 +- .../SnapSVGAnimator/js/SnapSVGAnimator.min.js | 4 ++-- .../ExtensionContent/SnapSVGAnimator/js/app/component.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SnapSVGAnimatorPlatform/EclipseProject/ExtensionContent/SnapSVGAnimator/js/SnapSVGAnimator.js b/SnapSVGAnimatorPlatform/EclipseProject/ExtensionContent/SnapSVGAnimator/js/SnapSVGAnimator.js index 4e058b1..41ebf58 100644 --- a/SnapSVGAnimatorPlatform/EclipseProject/ExtensionContent/SnapSVGAnimator/js/SnapSVGAnimator.js +++ b/SnapSVGAnimatorPlatform/EclipseProject/ExtensionContent/SnapSVGAnimator/js/SnapSVGAnimator.js @@ -1689,7 +1689,7 @@ function SVGAnim(data, w, h, fps, params) { if (autoplay) { instance.play(); } else { - interval(); + instance.stop(); } } diff --git a/SnapSVGAnimatorPlatform/EclipseProject/ExtensionContent/SnapSVGAnimator/js/SnapSVGAnimator.min.js b/SnapSVGAnimatorPlatform/EclipseProject/ExtensionContent/SnapSVGAnimator/js/SnapSVGAnimator.min.js index d52f453..fb7836e 100644 --- a/SnapSVGAnimatorPlatform/EclipseProject/ExtensionContent/SnapSVGAnimator/js/SnapSVGAnimator.min.js +++ b/SnapSVGAnimatorPlatform/EclipseProject/ExtensionContent/SnapSVGAnimator/js/SnapSVGAnimator.min.js @@ -1,2 +1,2 @@ -/*! SnapSVGAnimator 2016-10-28 */ -var SVGAnim=function(root){function updateMaskContent(a,b){var c=b.maskElement,d=a.getChildById(b.id);c.clear(),clone=d.el.clone(),clone.attr({visibility:"visible"}),c.append(clone)}function SVGAnim(a,b,c,d,e){function f(b){var c,e,f;for(void 0!==n.rootAnimator&&n.rootAnimator.dispose(),n.linkage={},f=a.DOMDocument.Timeline.length-1;f>-1;f-=1){if("undefined"==typeof a.DOMDocument.Timeline[f].linkageName){c=f;break}n.linkage[a.DOMDocument.Timeline[f].linkageName]=a.DOMDocument.Timeline[f]}e=n.resourceManager.m_data.DOMDocument.Timeline[c],n.mc=new MovieClip(e,n.s,n.resourceManager,id),l=setTimeout(g,1e3/d)}function g(){j&&n.mc._animate(),clearTimeout(l),l=setTimeout(g,1e3/d)}function h(a){switch(a.keyCode){case 65:g();break;case 32:n.mc.playing?n.stop():n.play()}}function i(){function a(b,d){var e,f;for(f=0;fe;e+=1)c+="-";c+=d.children[f].id+":"+d.children[f].children.length,d.children[f].isMask&&(c+=" (MASK till:"+d.children[f].maskTill+")"),d.children[f].isMasked&&(c+=" (masked by: "+d.children[f].mask+")"),c+="
",a(b+5,d.children[f])}}var b=document.getElementById("debug"),c="";b||(b=document.createElement("div"),b.id="debug",b.style.position="absolute",b.style.top="0",b.style.right="0",b.style.backgroundColor="black",b.style.color="white",b.style.padding="1em",document.body.appendChild(b)),c+=n.mc.id+"
",c+=n.mc.m_currentFrameNo+"
",a(2,n.mc),b.innerHTML=c}var j,k,l,m,n=this,o="#008460";n.version="1.2.3",m="Snap.svg Animator v"+n.version,console.log("%c"+m,"color:"+o+";font-weight:bold;"),e=e||{},d=d||24,b=b||100,c=c||100,k="undefined"!=typeof e.autoplay?e.autoplay:!0,j=k,n.debug=!1,n.debug&&(console.log("%c/*DEBUG*/","color:#FF6666;font-weight:bold;"),j=!1,k=!1,window.addEventListener("keydown",h)),SVGAnim.prototype.toString=function(){return m},n.MovieClip=MovieClip,n.resourceManager=new ResourceManager(a),n.s=new Snap(b,c),id=n.s.id,n.s.attr("id",id),n.s.attr("viewBox","0 0 "+b+" "+c),n.s.attr("preserveAspectRatio","xMidYMid meet"),f(n.s),this.play=function(){n.mc.play(),j=!0},this.stop=function(){0==n.mc.m_currentFrameNo&&n.mc._animate(),n.mc.stop(),j=!1},this.setLoop=function(a){n.mc.loops=a},n.debug&&setInterval(i,100),k?n.play():g()}SVGAnim.version="0.0.2";var GarbagePool=function(){this.EMPTY_POOL=[],this.REF_POOL=[]};GarbagePool.prototype.addEmpty=function(a){this.EMPTY_POOL.push(a)},GarbagePool.prototype.addRef=function(a,b){var c,d;for(c=0;c-1;a-=1)b=this.EMPTY_POOL[a],0===b.children().length&&(b.remove(),this.EMPTY_POOL.splice(a,1))},GarbagePool.prototype.purgeRefPool=function(){var a,b,c,d;for(a=this.REF_POOL.length-1;a>-1;a-=1)for(d=this.REF_POOL[a],c=0,b=0;b-1;)j+=b.txt.charAt(l),f=a.text(0,0,j),f.attr(d),h=f.getBBox(),h.w>k?(newIndex=j.lastIndexOf(" "),e=j.slice(0,newIndex),i.push(e),l=l-(j.length-e.length)+2,j=""):l+=1,l>=b.txt.length&&(e=j.slice(0,newIndex),i.push(e),l=-1),f.remove();return text=a.text(0,0,i),g=text.selectAll("tspan"),g.attr({x:0,dy:h.h+parseFloat(b.paras[0].linespacing)}),text},this.create()},Shape=function(a,b,c,d,e,f){function g(a){var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return b?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null}function h(a,b,c){var d,e;return d=i.el.image(a),e=d.pattern(0,0,b.width,b.height),e.attr({x:c.e,y:c.f}),e}var i=this,j=a.el;this.create=function(){var g,h,k,l;for(i.el=a.el.g(),i.id=d,i.el.attr({"class":"shape",token:i.id}),i.children=[],i.isMask=!1,i.isMasked=!1,i.mask=null,i.maskTill=null,g=0;g=0;e--)if(a===c[e].name){a=parseInt(c[e].frameNum)+1,d=!0;break}if(d===!1)return}if(!(1>a||a>this.m_frameCount)){if(a==this.m_currentFrameNo)return void(b===!1?this.play():this.stop());if(this.play(),a-1){var a=Array.prototype.slice.call(arguments);a.unshift(this.id.toUpperCase())}};var CMD={};CMD.PlaceObjectCommand=function(a,b,c,d,e,f){this.m_charID=a,this.m_objectID=b,this.m_name=c,this.m_placeAfter=d,this.m_transform=e,this.m_bounds=f},CMD.PlaceObjectCommand.prototype.execute=function(a,b){var c,d,e,f,g,h=b.getShape(this.m_charID),i=b.getBitmap(this.m_charID),j=b.getText(this.m_charID);null!==h&&void 0!==h?(d=new Shape(a,b,this.m_charID,this.m_objectID,this.m_placeAfter,this.m_transform),a.insertAtIndex(d,this.m_placeAfter)):null!==i&&void 0!==i?(e=new Bitmap(a,b,this.m_charID,this.m_objectID,this.m_placeAfter,this.m_transform),a.insertAtIndex(e,this.m_placeAfter)):null!==j&&void 0!==j?(c=new Text(a,b,this.m_charID,this.m_objectID,this.m_placeAfter,this.m_transform,this.m_bounds),a.insertAtIndex(c,this.m_placeAfter)):(f=b.getMovieClip(this.m_charID),f&&(g=new MovieClip(f,a,b,this.m_objectID,this.m_name,this.m_transform),a.insertAtIndex(g,this.m_placeAfter),g.play()))},CMD.MoveObjectCommand=function(a,b){this.m_objectID=a,this.m_transform=b},CMD.MoveObjectCommand.prototype.execute=function(a,b){var c,d,e;c=this.m_transform,d=c.split(","),e=new Snap.Matrix(d[0],d[1],d[2],d[3],d[4],d[5]),child=a.getChildById(this.m_objectID),child.matrix=e,child.el.transform(e)},CMD.UpdateObjectCommand=function(a,b){this.m_objectID=a,this.m_placeAfter=b},CMD.UpdateObjectCommand.prototype.execute=function(a,b){},CMD.RemoveObjectCommand=function(a){this.m_objectID=a},CMD.RemoveObjectCommand.prototype.execute=function(a,b){var c;c=a.getChildById(this.m_objectID),c.el.remove(),a.removeChildById(this.m_objectID)},CMD.UpdateVisibilityCommand=function(a,b){this.m_objectID=a,this.m_visibility=b},CMD.UpdateVisibilityCommand.prototype.execute=function(a,b){var c,d;c=a.getChildById(this.m_objectID),d="true"==this.m_visibility?"visible":"hidden",c.el.attr({visibility:d})},CMD.UpdateMaskCommand=function(a,b){this.m_objectID=a,this.m_maskTill=b},CMD.UpdateMaskCommand.prototype.execute=function(a,b){var c,d;maskContent=a.getChildById(this.m_objectID),maskContent.isMask=!0,maskContent.maskTill=this.m_maskTill,c=a.el.mask(),c.attr("mask-type","alpha"),clone=maskContent.el.clone(),clone.attr({visibility:"visible"}),d=c.toDefs(),d.append(clone),maskContent.maskElement=d,maskContent.el.attr({visibility:"hidden"})},CMD.ApplyMaskCommand=function(){},CMD.ApplyMaskCommand.prototype.execute=function(a,b){var c,d,e=!1,f=null,g=null,h=null;for(c=0;c-1;f-=1){if(void 0===a.DOMDocument.Timeline[f].linkageName){c=f;break}n.linkage[a.DOMDocument.Timeline[f].linkageName]=a.DOMDocument.Timeline[f]}e=n.resourceManager.m_data.DOMDocument.Timeline[c],n.mc=new MovieClip(e,n.s,n.resourceManager,id),l=setTimeout(g,1e3/d)}function g(){j&&n.mc._animate(),clearTimeout(l),l=setTimeout(g,1e3/d)}function h(a){switch(a.keyCode){case 65:g();break;case 32:n.mc.playing?n.stop():n.play()}}function i(){function a(b,d){var e,f;for(f=0;f",c+=n.mc.m_currentFrameNo+"
",a(2,n.mc),b.innerHTML=c}var j,k,l,m,n=this;n.version="1.2.3",m="Snap.svg Animator v"+n.version,console.log("%c"+m,"color:#008460;font-weight:bold;"),e=e||{},d=d||24,b=b||100,c=c||100,k=void 0===e.autoplay||e.autoplay,j=k,n.debug=!1,n.debug&&(console.log("%c/*DEBUG*/","color:#FF6666;font-weight:bold;"),j=!1,k=!1,window.addEventListener("keydown",h)),SVGAnim.prototype.toString=function(){return m},n.MovieClip=MovieClip,n.resourceManager=new ResourceManager(a),n.s=new Snap(b,c),id=n.s.id,n.s.attr("id",id),n.s.attr("viewBox","0 0 "+b+" "+c),n.s.attr("preserveAspectRatio","xMidYMid meet"),f(n.s),this.play=function(){n.mc.play(),j=!0},this.stop=function(){0==n.mc.m_currentFrameNo&&n.mc._animate(),n.mc.stop(),j=!1},this.setLoop=function(a){n.mc.loops=a},n.debug&&setInterval(i,100),k?n.play():n.stop()}SVGAnim.version="0.0.2";var GarbagePool=function(){this.EMPTY_POOL=[],this.REF_POOL=[]};GarbagePool.prototype.addEmpty=function(a){this.EMPTY_POOL.push(a)},GarbagePool.prototype.addRef=function(a,b){var c,d;for(c=0;c-1;a-=1)b=this.EMPTY_POOL[a],0===b.children().length&&(b.remove(),this.EMPTY_POOL.splice(a,1))},GarbagePool.prototype.purgeRefPool=function(){var a,b,c,d;for(a=this.REF_POOL.length-1;a>-1;a-=1)for(d=this.REF_POOL[a],c=0,b=0;b-1;)j+=b.txt.charAt(l),f=a.text(0,0,j),f.attr(d),h=f.getBBox(),h.w>k?(newIndex=j.lastIndexOf(" "),e=j.slice(0,newIndex),i.push(e),l=l-(j.length-e.length)+2,j=""):l+=1,l>=b.txt.length&&(e=j.slice(0,newIndex),i.push(e),l=-1),f.remove();return text=a.text(0,0,i),g=text.selectAll("tspan"),g.attr({x:0,dy:h.h+parseFloat(b.paras[0].linespacing)}),text},this.create()},Shape=function(a,b,c,d,e,f){function g(a){var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return b?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null}function h(a,b,c){var d,e;return d=i.el.image(a),e=d.pattern(0,0,b.width,b.height),e.attr({x:c.e,y:c.f}),e}var i=this,j=a.el;this.create=function(){var g,h,k,l;for(i.el=a.el.g(),i.id=d,i.el.attr({class:"shape",token:i.id}),i.children=[],i.isMask=!1,i.isMasked=!1,i.mask=null,i.maskTill=null,g=0;g=0;e--)if(a===c[e].name){a=parseInt(c[e].frameNum)+1,d=!0;break}if(!1===d)return}if(!(a<1||a>this.m_frameCount)){if(a==this.m_currentFrameNo)return void(!1===b?this.play():this.stop());if(this.play(),a-1){Array.prototype.slice.call(arguments).unshift(this.id.toUpperCase())}};var CMD={};CMD.PlaceObjectCommand=function(a,b,c,d,e,f){this.m_charID=a,this.m_objectID=b,this.m_name=c,this.m_placeAfter=d,this.m_transform=e,this.m_bounds=f},CMD.PlaceObjectCommand.prototype.execute=function(a,b){var c,d,e,f,g,h=b.getShape(this.m_charID),i=b.getBitmap(this.m_charID),j=b.getText(this.m_charID);null!==h&&void 0!==h?(d=new Shape(a,b,this.m_charID,this.m_objectID,this.m_placeAfter,this.m_transform),a.insertAtIndex(d,this.m_placeAfter)):null!==i&&void 0!==i?(e=new Bitmap(a,b,this.m_charID,this.m_objectID,this.m_placeAfter,this.m_transform),a.insertAtIndex(e,this.m_placeAfter)):null!==j&&void 0!==j?(c=new Text(a,b,this.m_charID,this.m_objectID,this.m_placeAfter,this.m_transform,this.m_bounds),a.insertAtIndex(c,this.m_placeAfter)):(f=b.getMovieClip(this.m_charID))&&(g=new MovieClip(f,a,b,this.m_objectID,this.m_name,this.m_transform),a.insertAtIndex(g,this.m_placeAfter),g.play())},CMD.MoveObjectCommand=function(a,b){this.m_objectID=a,this.m_transform=b},CMD.MoveObjectCommand.prototype.execute=function(a,b){var c,d,e;c=this.m_transform,d=c.split(","),e=new Snap.Matrix(d[0],d[1],d[2],d[3],d[4],d[5]),child=a.getChildById(this.m_objectID),child.matrix=e,child.el.transform(e)},CMD.UpdateObjectCommand=function(a,b){this.m_objectID=a,this.m_placeAfter=b},CMD.UpdateObjectCommand.prototype.execute=function(a,b){},CMD.RemoveObjectCommand=function(a){this.m_objectID=a},CMD.RemoveObjectCommand.prototype.execute=function(a,b){var c;c=a.getChildById(this.m_objectID),c.el.remove(),a.removeChildById(this.m_objectID)},CMD.UpdateVisibilityCommand=function(a,b){this.m_objectID=a,this.m_visibility=b},CMD.UpdateVisibilityCommand.prototype.execute=function(a,b){var c,d;c=a.getChildById(this.m_objectID),d="true"==this.m_visibility?"visible":"hidden",c.el.attr({visibility:d})},CMD.UpdateMaskCommand=function(a,b){this.m_objectID=a,this.m_maskTill=b},CMD.UpdateMaskCommand.prototype.execute=function(a,b){var c,d;maskContent=a.getChildById(this.m_objectID),maskContent.isMask=!0,maskContent.maskTill=this.m_maskTill,c=a.el.mask(),c.attr("mask-type","alpha"),clone=maskContent.el.clone(),clone.attr({visibility:"visible"}),d=c.toDefs(),d.append(clone),maskContent.maskElement=d,maskContent.el.attr({visibility:"hidden"})},CMD.ApplyMaskCommand=function(){},CMD.ApplyMaskCommand.prototype.execute=function(a,b){var c,d,e=!1,f=null,g=null,h=null;for(c=0;c