There is a very nice JSFL script “Sel2Draw” (http://debreuil.com/ASDraw/) which converts selected Flash IDE drawings to vector data (as2), line & spline primitives, see example in Appendix. Read 3D Vectors: From Vector Illustrations Via Sel2draw Into FiVe3d http://www.motiondraw.com/blog/?p=119
Other links:
1. Converting SVG to FIVE3D, Flash Vector Graphics and Html5 Canvas
2. Shape Export to Objective-C
Appendix.
var drw0 = [
{ fill:[0x3cc00],
origin:[20,70],
records:[[20,49.25,34.6,34.6], [49.25,20,70,20], [90.75,20,105.35,34.6], [120,49.25,120,70], [120,90.75,105.35,105.35], [90.75,120,70,120], [49.25,120,34.6,105.35], [20,90.75,20,70]],
strokes:[[1,0x06600], “-”, “-”, “-”, “-”, “-”, “-”, “-”]
},
{ fill:”stroke”,
origin:[20,10],
records:[[120,10]],
strokes:[[1,0x06600]]
}];
// =====================
//create drawing here:
// =====================
_root.createEmptyMovieClip(“dr0″, 1000);
var img0 = _root["dr0"];
drawImage(img0, drw0);
var drawImage = function(clip, dat)
{ var prevFill = null;
for(var el = 0; el < dat.length; el++)
{ var element = dat[el];
clip.moveTo(element.origin[0],element.origin[1]);
if( element.fill == -1 || element.fill == “stroke”)
{ if(prevFill != “stroke”)
{ clip.endFill();
prevFill = element.fill;
}
}else if(element.fill != “donut”)
{ if(element.fill.length != 5)
{ clip.beginFill.apply(clip, element.fill);
}else
{ clip.beginGradientFill.apply(clip, element.fill);
}
prevFill = element.fill;
}
var recs = element.records;
var strokes = element.strokes;
var curStroke = -1;
if(strokes[0] == null)
{ clip.lineStyle();
}else
{ clip.lineStyle.apply(clip, strokes[0]);
}
for(var i = 0; i < recs.length; i++)
{ curStroke = strokes[i];
if(curStroke != “-”)
{ if(curStroke == null)
{ clip.lineStyle();
}else
{ clip.lineStyle(curStroke[0], curStroke[1]);
}
}
var rec = recs[i];
if(rec.length == 4)
{ clip.curveTo(rec[0],rec[1],rec[2],rec[3]);
}
else
{ clip.lineTo(rec[0],rec[1]);
}
}
} clip.endFill();
return clip;
}
Tags: SVG, Vector data