forked from: SVGファイルのXMLをローカルで使用する on 2010-1-28
forked from SVGファイルのXMLをローカルで使用する on 2010-1-28 (diff: 1)
ActionScript3 source code
/**
* Copyright misusu1224 ( http://wonderfl.net/user/misusu1224 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/593T
*/
// forked from komatsu's SVGファイルのXMLをローカルで使用する on 2010-1-28
/*
svgファイルは、Illustrator上で別名保存で作成しました。
svgファイル内のXMLで、閉じるタグ以外で改行コードが入っている場合、パースのエラーが起きるっぽいので注意!
汎用的ではないけど、ベクターのデータをクラスを呼び出す感覚で使いたい場合に、もしかしたら使うかもしれない。(たぶん使わないかなあ・・)
*/
package {
import flash.net.*;
import flash.display.Sprite;
import flash.events.*
import flash.system.*;
import caurina.transitions.Tweener;
public class LocalSvg extends Sprite {
public function LocalSvg() {
var sp:ReturnSvgSprite = new ReturnSvgSprite();
addChild( sp );
//アニメーション設定
Tweener.addTween(sp , {scaleX:2 , scaleY:2 , delay:1 , time:1,transition:"easeOutElastic"});
Tweener.addTween(sp , {scaleX:4 , scaleY:4 , delay:4 , time:1,transition:"easeOutElastic"});
Tweener.addTween(sp , {scaleX:6 , scaleY:6 , delay:7 , time:1,transition:"easeOutElastic"});
}
}
}
import flash.display.Sprite;
import frocessing.shape.FShapeSVG;
class ReturnSvgSprite extends Sprite{
public function ReturnSvgSprite(){
var svgXml:XML = getSvgXML();
var shapedata:FShapeSVG = new FShapeSVG(svgXml);
addChild(shapedata.toSprite());
}
private function getSvgXML():XML{
var rXML:XML =
<svg version="1.0" id="レイヤー_1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" aaa:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:aaa="http://www.w3.org/XML/1998/namespace">
<g>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#626262" d="M54.585,76.261l7.14,1.62c-1.8,9.359-3.18,14.04-4.2,13.98l-6.359,0.299l-1.98-0.119c-0.539-0.18-0.9-0.48-1.14-0.9c-0.54-0.96-0.479-1.859,0.12-2.699c0.66-0.9,1.619-1.32,3-1.261c0.779,0.06,1.739,0.181,2.88,0.479l0.54,0.061c0.12-0.061,0.18-0.24,0.18-0.54C54.824,85.381,54.765,81.721,54.585,76.261"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M61.725,77.881c-1.8,9.359-3.18,14.04-4.2,13.98l-6.359,0.299l-1.98-0.119c-0.539-0.18-0.9-0.48-1.14-0.9c-0.54-0.96-0.479-1.859,0.12-2.699c0.66-0.9,1.619-1.32,3-1.261c0.779,0.06,1.739,0.181,2.88,0.479l0.54,0.061c0.12-0.061,0.18-0.24,0.18-0.54c0.06-1.8,0-5.46-0.18-10.92"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M49.425,75.66c-0.3-2.159-0.359-3.659-0.18-4.56c0.9-4.5-0.42-7.86-3.84-10.02l-0.18,9.72c-0.061,2.28,0.42,4.561,1.319,6.78c1.021,2.52,2.34,3.72,3.84,3.659L49.425,75.66"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M49.425,75.66c-0.3-2.159-0.359-3.659-0.18-4.56c0.9-4.5-0.42-7.86-3.84-10.02l-0.18,9.72c-0.061,2.28,0.42,4.561,1.319,6.78c1.021,2.52,2.34,3.72,3.84,3.659L49.425,75.66"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#626262" d="M72.585,77.16c0,0.841-0.301,1.561-0.84,2.101c-0.54,0.601-1.2,0.899-1.98,0.899s-1.5-0.299-2.04-0.899c-0.54-0.54-0.84-1.26-0.84-2.101c0-0.779,0.3-1.5,0.84-2.1s1.26-0.9,2.04-0.9s1.44,0.301,1.98,0.9C72.284,75.66,72.585,76.381,72.585,77.16"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M72.585,77.16c0,0.841-0.301,1.561-0.84,2.101c-0.54,0.601-1.2,0.899-1.98,0.899s-1.5-0.299-2.04-0.899c-0.54-0.54-0.84-1.26-0.84-2.101c0-0.779,0.3-1.5,0.84-2.1s1.26-0.9,2.04-0.9s1.44,0.301,1.98,0.9C72.284,75.66,72.585,76.381,72.585,77.16"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#626262" d="M45.524,56.761l-0.119,4.32c3.42,2.159,4.74,5.52,3.84,10.02c-0.36,1.74-0.18,4.8,0.48,9.12c0.239,0.78,0.959,1.38,2.159,1.74l4.68,0.72c5.04,0.66,8.4-0.239,10.141-2.7c0.659-1.02,1.14-2.34,1.38-3.959c0.18-1.08,0.3-2.641,0.359-4.74l0.301-14.041c0.06-3.18-1.021-5.939-3.24-8.279c-2.221-2.34-4.98-3.54-8.16-3.6s-5.94,1.02-8.279,3.24C46.726,50.821,45.585,53.581,45.524,56.761"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M45.524,56.761l-0.119,4.32c3.42,2.159,4.74,5.52,3.84,10.02c-0.36,1.74-0.18,4.8,0.48,9.12c0.239,0.78,0.959,1.38,2.159,1.74l4.68,0.72c5.04,0.66,8.4-0.239,10.141-2.7c0.659-1.02,1.14-2.34,1.38-3.959c0.18-1.08,0.3-2.641,0.359-4.74l0.301-14.041c0.06-3.18-1.021-5.939-3.24-8.279c-2.221-2.34-4.98-3.54-8.16-3.6s-5.94,1.02-8.279,3.24C46.726,50.821,45.585,53.581,45.524,56.761"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#626262" d="M62.625,81.301c-0.9,6.9-1.801,10.38-2.82,10.439l-6.3,0.961l-1.98,0.06c-0.54-0.06-0.959-0.3-1.26-0.72c-0.6-0.9-0.66-1.801-0.119-2.7c0.54-0.96,1.439-1.5,2.819-1.62l2.939,0.18h0.54c0.061-0.06,0.12-0.239,0.12-0.539c-0.18-1.74-0.6-3.78-1.38-6.061H62.625"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M62.625,81.301c-0.9,6.9-1.801,10.38-2.82,10.439l-6.3,0.961l-1.98,0.06c-0.54-0.06-0.959-0.3-1.26-0.72c-0.6-0.9-0.66-1.801-0.119-2.7c0.54-0.96,1.439-1.5,2.819-1.62l2.939,0.18h0.54c0.061-0.06,0.12-0.239,0.12-0.539c-0.18-1.74-0.6-3.78-1.38-6.061"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#626262" d="M56.205,61.74l-1.021,6.181c-1.26-0.3-2.04,0.24-2.22,1.62c-0.24,1.38,0.54,2.22,2.28,2.52c0.06,1.561,0.659,2.461,1.92,2.641c1.26,0.18,1.979-0.54,2.279-2.16c1.86-0.18,2.94-0.9,3.12-2.221c0.24-1.379-0.72-2.219-2.939-2.58l0.84-5.34L56.205,61.74"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M56.205,61.74l-1.021,6.181c-1.26-0.3-2.04,0.24-2.22,1.62c-0.24,1.38,0.54,2.22,2.28,2.52c0.06,1.561,0.659,2.461,1.92,2.641c1.26,0.18,1.979-0.54,2.279-2.16c1.86-0.18,2.94-0.9,3.12-2.221c0.24-1.379-0.72-2.219-2.939-2.58l0.84-5.34"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.125,28.201c-0.78,1.32-1.2,2.7-1.261,4.14c-0.06,1.5,0.24,2.58,0.961,3.3c1.979,1.98,4.38,1.62,7.199-1.2c1.201-1.2,2.041-2.4,2.521-3.54c0.72-1.92,0.36-3.6-1.14-5.04c-1.801-0.9-3.48-1.08-4.98-0.48C24.104,25.801,23.024,26.761,22.125,28.201"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M22.125,28.201c-0.78,1.32-1.2,2.7-1.261,4.14c-0.06,1.5,0.24,2.58,0.961,3.3c1.979,1.98,4.38,1.62,7.199-1.2c1.201-1.2,2.041-2.4,2.521-3.54c0.72-1.92,0.36-3.6-1.14-5.04c-1.801-0.9-3.48-1.08-4.98-0.48C24.104,25.801,23.024,26.761,22.125,28.201"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M30.405,25.861c0.24,4.56-0.24,7.44-1.381,8.58c-0.959,0.9-3.359,1.32-7.199,1.2c-0.12,1.32-0.18,2.88-0.18,4.68c0,7.44,3.359,11.34,10.139,11.701l3.721,0.239l1.2,0.601c1.38,0.6,6.06,0.899,13.92,0.899h9.96c-6.96-6.06-11.82-10.5-14.52-13.2c-1.74-1.74-3.181-5.34-4.32-10.86c-0.9-4.08-1.561-9-2.04-14.7c-0.841,1.8-1.261,3.72-1.261,5.7v5.1L30.405,25.861"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M30.405,25.861c0.24,4.56-0.24,7.44-1.381,8.58c-0.959,0.9-3.359,1.32-7.199,1.2c-0.12,1.32-0.18,2.88-0.18,4.68c0,7.44,3.359,11.34,10.139,11.701l3.721,0.239l1.2,0.601c1.38,0.6,6.06,0.899,13.92,0.899h9.96c-6.96-6.06-11.82-10.5-14.52-13.2c-1.74-1.74-3.181-5.34-4.32-10.86c-0.9-4.08-1.561-9-2.04-14.7c-0.841,1.8-1.261,3.72-1.261,5.7v5.1L30.405,25.861"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#626262" d="M65.864,7.501l-7.08-0.42c-3.18-0.18-5.52,0-7.14,0.42c-2.7,0.78-4.979,1.62-6.72,2.52c-2.52,1.38-4.26,3-5.22,4.98c0.479,5.7,1.14,10.62,2.04,14.7c1.14,5.52,2.58,9.12,4.32,10.86c2.699,2.7,7.56,7.14,14.52,13.2h5.279c1.801,0,3.54-0.36,5.16-1.021c1.561-0.659,2.94-1.619,4.2-2.819c2.58-2.58,3.84-5.7,3.84-9.36v-19.86c0-3.3-1.74-6.36-5.16-9.3c-1.38-1.2-2.88-2.16-4.38-2.82C68.024,7.861,66.824,7.501,65.864,7.501"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M65.864,7.501l-7.08-0.42c-3.18-0.18-5.52,0-7.14,0.42c-2.7,0.78-4.979,1.62-6.72,2.52c-2.52,1.38-4.26,3-5.22,4.98c0.479,5.7,1.14,10.62,2.04,14.7c1.14,5.52,2.58,9.12,4.32,10.86c2.699,2.7,7.56,7.14,14.52,13.2h5.279c1.801,0,3.54-0.36,5.16-1.021c1.561-0.659,2.94-1.619,4.2-2.819c2.58-2.58,3.84-5.7,3.84-9.36v-19.86c0-3.3-1.74-6.36-5.16-9.3c-1.38-1.2-2.88-2.16-4.38-2.82C68.024,7.861,66.824,7.501,65.864,7.501"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#DE1407" d="M68.505,54.781h-25.92c-0.42,0-0.84,0.18-1.141,0.479c-0.299,0.3-0.42,0.66-0.42,1.08s0.121,0.84,0.42,1.14c0.301,0.301,0.721,0.48,1.141,0.48h25.92c0.42,0,0.84-0.18,1.14-0.48c0.3-0.3,0.42-0.72,0.42-1.14s-0.12-0.78-0.42-1.08S68.925,54.781,68.505,54.781"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M68.505,54.781h-25.92c-0.42,0-0.84,0.18-1.141,0.479c-0.299,0.3-0.42,0.66-0.42,1.08s0.121,0.84,0.42,1.14c0.301,0.301,0.721,0.48,1.141,0.48h25.92c0.42,0,0.84-0.18,1.14-0.48c0.3-0.3,0.42-0.72,0.42-1.14s-0.12-0.78-0.42-1.08S68.925,54.781,68.505,54.781"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#626262" d="M55.784,32.281l1.381,13.68c0.359,3.6,1.739,6.6,4.14,8.939c2.34,2.34,5.04,3.36,7.979,3.061l1.44-0.12c3-0.3,5.4-1.86,7.26-4.681c1.86-2.759,2.58-5.939,2.221-9.599l-1.44-13.68L55.784,32.281"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M55.784,32.281l1.381,13.68c0.359,3.6,1.739,6.6,4.14,8.939c2.34,2.34,5.04,3.36,7.979,3.061l1.44-0.12c3-0.3,5.4-1.86,7.26-4.681c1.86-2.759,2.58-5.939,2.221-9.599l-1.44-13.68"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M56.385,23.821c0,2.58-0.66,4.8-1.98,6.66c-1.319,1.86-2.88,2.76-4.739,2.76c-1.86,0-3.48-0.9-4.74-2.76c-1.38-1.86-2.04-4.08-2.04-6.66s0.66-4.8,2.04-6.66c1.26-1.86,2.88-2.76,4.74-2.76c1.859,0,3.42,0.9,4.739,2.76C55.725,19.021,56.385,21.241,56.385,23.821"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M56.385,23.821c0,2.58-0.66,4.8-1.98,6.66c-1.319,1.86-2.88,2.76-4.739,2.76c-1.86,0-3.48-0.9-4.74-2.76c-1.38-1.86-2.04-4.08-2.04-6.66s0.66-4.8,2.04-6.66c1.26-1.86,2.88-2.76,4.74-2.76c1.859,0,3.42,0.9,4.739,2.76C55.725,19.021,56.385,21.241,56.385,23.821"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M45.045,23.821c0,0.9-0.181,1.38-0.479,1.38c-0.301,0-0.42-0.48-0.42-1.38s0.119-1.38,0.42-1.38C44.864,22.441,45.045,22.921,45.045,23.821"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M47.085,52.021c3.36,0-3.359-0.541-20.16-1.561C36.944,51.48,43.665,52.021,47.085,52.021"/>
<path fill="none" stroke="#000000" stroke-width="1.02" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M26.925,50.461c10.02,1.02,16.74,1.561,20.16,1.561"/>
</g>
</svg>;
return rXML;
}
}
