diff --git a/projectSVG.js b/projectSVG.js index 67af214..651cdd6 100755 --- a/projectSVG.js +++ b/projectSVG.js @@ -2,36 +2,6 @@ /** * Frontend js file to generate an cube of svg's */ -// http://cssdeck.com/labs/pure-css-animated-isometric-boxes - - - -// polyfill for bind https://github.com/ariya/phantomjs/issues/11281 -if (!Function.prototype.bind) { - console.log("Using polyfill of Function.prototype.bind"); - Function.prototype.bind = function (oThis) { - if (typeof this !== "function") { - // closest thing possible to the ECMAScript 5 - // internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); - } - - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () {}, - fBound = function () { - return fToBind.apply(this instanceof fNOP && oThis - ? this - : oThis, - aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - }; -} var SvgCube = function (options) { @@ -56,22 +26,17 @@ var SvgCube = function (options) { "stroke-width": 0, // outline width }, // cube - topUrl: '', // url for image in top of cuve + svgPanel: '', // url for image in top of cuve topRot: 0, // rotation of top image in degrees topShad: 0, // shading for top - leftUrl: '', leftRot: 0, leftShad: 0.0, - rightUrl: '', rightRot: 0, rightShad: 0.0, - backUrl: '', backRot: 0, backShad: 0.0, - bottomUrl: '', bottomRot: 0, bottomShad: 0.0, - frontUrl: '', frontRot: 0, frontShad: 0.0, }; @@ -124,8 +89,75 @@ SvgCube.prototype.init = function () { // create SVG element var o = this.options; + /** Write sides if they have not already been written **/ + if ($('body>.cube').length === 0) { + var cube = $('
'); + + var imageFront = $('' + + '' + + '' + + ''); + cube.append(imageFront); + + var imageL = $('' + + '' + + '' + + ''); + cube.append(imageL); + + var imageRight = $('' + + '' + + ' ' + + ''); + cube.append(imageRight); + + var imageTop = $('' + + '' + + '' + + ''); + cube.append(imageTop); + + var imageBack = $('' + + '' + + '' + + ''); + cube.append(imageBack); + + var imageBottom = $('' + + '' + + '' + + ''); + cube.append(imageBottom); + + $('body').append(cube); + + } // Now we generate some css to put everything in good positions - var transitions = 0; + var transitions = 0.1; var styleStr = '' + ''; - - - if ($('body>.cube').length === 0) { - var cube = $(''); - - var imageFront = $(''); - cube.append(imageFront); - - var imageL = $(''); - cube.append(imageL); - - var imageRight = $(''); - cube.append(imageRight); - - var imageTop = $(''); - cube.append(imageTop); - - var imageBack = $(''); - cube.append(imageBack); - - var imageBottom = $(''); - cube.append(imageBottom); - - $('body').append(cube); - - - /* TODO these will fill in some color inside in order to allow curved edges without seeing through cube, sues o.stroke.stroke for color */ - // var xMid = $(``) - // cube.append(xMid); - // - // var yMid = $(`The buttons allow you to try different parameters.
The front, left, etc svg's are just linked to panel.svg
- +