/* This is a basic attempt to use d3 to process transitional slides from SVG files (i.e. Inkscape) The main objective here was to keep everything as simple as possible To create a slide, simply create a rectangle in inkscape where you set the object ID to "slide_" + a number This number can be either integer or float, so "slide_1","slide_2" and "slide_3.56" all work. The script sorts the slide-numbers and transitions between slides based on the final sorted order. It is easy to add slides into a pre-existing ordering, simply by chosing a floating number in the middle of the two Example: If we want to add slide between "slide_2" and "slide_3" we simply add a rectancle called "slide_2.5" Keyboard definitions: Right arrow: next slide Left arrow: previous slide Home: first slide End: last slide Please be aware that you need to remove any layer transition is the svg file (or put the layer transition to 0,0) Each slide has a scale_x and scale_y functions that have pre-set range to the slide boundaries and a default domain of [0,1000], allowing the user to position objects easily onto each slide. ziggy.jonsson.nyc@gmail.com */ function svg_slides(svg,delay) { var slides={}, slide = 0, delay = delay ? delay : 3500; svg.attr("preserveAspectRatio","xMidYid meet"); rects = svg.selectAll("rect")[0]; for (i=0;i0) {slide=slide-1; console.log(slide);next_slide()};break} case 39: {if(slide