-
Notifications
You must be signed in to change notification settings - Fork 0
SVG and javascript
My plan was to dynamical load vector-graphics and combine them to an image just like you can stack multiple images in css-background.
With the svg-<use> command it should be possible to combine the separatly loaded svg into one scene.
But I run into several problems here:
- svg can be loaded via
<img>but then you cannot access each component of svg for re-styling - you can either inline-embed an SVG in html or use
<object>to load dynamical from a path - first one is ugly to edit (copy paste from svg-file)
- I CANNOT access contentDocument (opposed to the many examples out there) from the loaded svg inside
<object>because of cross-origin-blocking for local files ! - both are creating a visible image; but I just want to get the svg loaded to be able to
<use>them
So my current workaround is like this:
- create a js-function that builds a svg-html-string for a picture (copy paste svg-code from svg-file into function; remove all line breaks)
- those functions are called in the passage-script to add the svg-html to the ''-container of the scene-svg
- the scene can now
<use>those svg-html because it exists in the html-document
Example:
//sample svg-html-generator window.gm.images.wolf2 = function() { return('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="wolf2">.....</svg>'); };
window.gm.printSceneGraphic=function() {
var width=600,height=300;
var draw = SVG().addTo('#canvas').size(width, height); //initilize SVG, pointing to scene-canvas (just a
Todo: how to load a svg-file from disk and append its content to <devs>-container of scene-svg? This is not possible because of cross-origin-blocking?
What is twine and interactive fiction
Exampl. SuperSimpleStory
What are storyformats
Why snowman
Setup tweego and snowman
Switching between Tweego and Twine
Snowman template methods
Snowman markup
javascript usage
debugging your story
Common issues with template methods and scripting
Story Telling in general
General concepts for IF
Scenes & Sequels
Designing Puzzles
See here about my js-framework running in snowman:
==> problems & solutions <==