html - A SVG file in a SVG game? -



html - A SVG file in a SVG game? -

i'm trying create svg game. can't svg file (made inkscape) take place in game.

i'm aware of embed , utilize of objects , iframes:

<embed src="spaceship.svg" type="image/svg+xml" /> <object data="spaceship.svg" type="image/svg+xml"></object> <iframe src="spaceship.svg"></iframe>

but doesn't work jumps outside of svg game.

is possible place svg file in svg tag? or should stick canvas games?

do want dynamically load svg file existing svg file or want multiple svg objects in svg file - so:

<?xml version="1.0" standalone="no"?> <!doctype svg public "-//w3e//dtd svg 1.1//en" "http://www.w3.org/graphics/svg/1.1/dtd/svg11.dtd"> <svg preserveaspectratio="none" viewbox="0 0 10000 10000" version="1.1" xmlns="http://www.w3.org/2000/svg" onload="init();"> <script type="text/ecmascript"><![cdata[ function init() { alert(document.getelementbyid("map_line")); } ]]></script> <svg id="map" x="0" y="0" width="7500" height="10000" preserveaspectratio="none" viewbox="0 0 10000 10000" cursor="crosshair" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="10000" height="10000" fill="black" /> <line id="map_line" x1="0" y1="0" x2="10000" y2="10000" stroke="red" stroke-width="25" /> </svg> <svg id="mini_map" x="7500" y="0" width="2500" height="2500" preserveaspectratio="none" viewbox="0 0 10000 10000" cursor="crosshair" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="10000" height="10000" stroke-width="10" stroke="silver" fill="black" /> <line x1="0" y1="0" x2="10000" y2="10000" stroke="red" stroke-width="25" /> </svg> <svg id="info" x="7500" y="2500" width="2500" height="7500" preserveaspectratio="none" viewbox="0 0 1000 1000" cursor="default" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="1000" height="1000" fill="#333333" /> <line x1="0" y1="0" x2="1000" y2="1000" stroke="red" stroke-width="25" /> </svg> </svg>

html html5 svg

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -