Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When exporting SVGs from illustrator, the following settings should produce working results. This does however depend on your version of illustrator. 


Code Block
PShape elShapelogo;
PShape warningShapeNASA;
float  rotAngle = 0.0;


void setup()
{
  size(600, 600);      // def. window size 

  // Loadload theSVG svg filefiles
  elShape      logo = loadShape("High_voltage_warningiadlogo.svg");
  warningShapeNASA  = loadShape("Achtungnasalogo.svg");

  shapeMode(CENTER);    // set the zeroimages pointto ofbe thedrawn SVGfrom objectthe is in the middlecenter point
  smooth();
}


void draw()
{
  background(255);


  pushMatrix();
 
  translate(width *.5, height *.5);
 
  rotate(rotAngle);

   shape(elShapelogo, 0, 0,200,200 logo.width, logo.height);  
  popMatrix();
  rotAngle+=.01;
  pushMatrix();
  float scaleFactor =dist(mouseX, mouseY, width/2, height/2);
  scaleFactor = shape(warningShape,mouseX,mouseY,100,100map(scaleFactor, 0, width, 1, 4);
  translate(mouseX, mouseY);
  scale(scaleFactor);

  shape(NASA, 0, 0, NASA.width, NASA.height);

  popMatrix();
}

Download source



In this example, 2D images (bitmap) are displayed and arrays are used. Here we use a 1. Dimensional array. To access an element of this array, we use these '[index]' brackets.

...