Commit ac66c067 authored by amandaghassaei's avatar amandaghassaei

import variable angles in svg

parent 70c09d89
......@@ -32,8 +32,8 @@ function initImporter(globals){
}
var file = files[0];
var name = file.name;
var extension = name.split(".");
var extension = file.name.split(".");
var name = extension[0];
extension = extension[extension.length - 1];
var reader = new FileReader();
......
......@@ -39,18 +39,22 @@ function initPattern(globals){
});
var $mountains = $paths.filter(function(){
var color = hexToColor($(this).attr("stroke").toLowerCase());
if (color.r > 0 && color.g == 0 && color.b == 0){
_mountainAngles.push(-color.r*Math.PI);
var stroke = $(this).attr("stroke").toLowerCase();
if (stroke == "#ff0000" || stroke == "#f00"){
var opacity = parseFloat($(this).attr("opacity"));
if (isNaN(opacity)) opacity = 1;
_mountainAngles.push(-opacity*Math.PI);
return true;
}
return false;
});
var $valleys = $paths.filter(function(){
var color = hexToColor($(this).attr("stroke").toLowerCase());
if (color.b > 0 && color.g == 0 && color.r == 0){
_valleyAngles.push(color.b*Math.PI);
var stroke = $(this).attr("stroke").toLowerCase();
if (stroke == "#0000ff" || stroke == "#00f"){
var opacity = parseFloat($(this).attr("opacity"));
if (isNaN(opacity)) opacity = 1;
_valleyAngles.push(opacity*Math.PI);
return true;
}
return false;
......@@ -105,14 +109,6 @@ function initPattern(globals){
});
}
function hexToColor(stroke){
stroke = stroke.slice(1);
if (stroke.length == 3){
stroke = stroke[0]+stroke[0]+stroke[1]+stroke[1]+stroke[2]+stroke[2];
}
return new THREE.Color(parseInt("0x" + stroke));
}
function parsePath(_verticesRaw, _segmentsRaw, $paths, angles){
for (var i=0;i<$paths.length;i++){
var segments = $paths[i].getPathData();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment