I found the perfect (almost) code on this forum. I am a novice at programming. I've really tried, but I can't move forward without help!
1. This code works fine for me in the environment. However, when I export it as an applet it doesn't show in index.html. Why is this? Is there something that I need to make this happen? I believe I'm calling the right libraries.
2. Also, as I am not using mousePressed I don't need it in the sketch... but I can't figure out how to remove it from the if test.
// global variables
RShape grp;
String svgFile;
ArrayList ve;
int nve = 1;
int colo;
// global params
float pl = 1.0; // maximum segments length
void setup() {
// Initilaize the sketch
size (827, 1000);
frameRate(24);
ve= new ArrayList();
// Choice of colors
background(255);
fill(255, 102, 0);
stroke(100);
strokeWeight(1);
// VERY IMPORTANT: Allways initialize the library in the setup
RG.init(this);
//svgFile = selectInput();
svgFile = "Drawing machine [1].svg";
grp = RG.loadShape(svgFile);
//grp = RG.centerIn(grp, g);
// Set the origin to draw in the middle of the sketch
//translate(width/2, height/4);
// Enable smoothing
smooth();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// recursively find RShape children and "flattens", by putting vertices inside an array
//
void exVert(RShape s) {
RShape[] ch; // children
int n, i, j;
RPoint[][] pa;
n = s.countChildren();
if (n > 0) {
ch = s.children;
for (i = 0; i < n; i++) {
exVert(ch[i]);
}
}
else { // no children -> work on vertex
pa = s.getPointsInPaths();
n = pa.length;
for (i=0; i<n; i++) {
for (j=0; j<pa[i].length; j++) {
if (j==0)
ve.add(new Point(pa[i][j].x, pa[i][j].y, -10.0));
else
ve.add(new Point(pa[i][j].x, pa[i][j].y, 0.0));
}
}
println("#paths: " + pa.length);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Class for a 3D point
//
class Point {
float x, y, z;
Point(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}