Geomerative: controlling caps and joins appearances

Hello Everyone,

I am trying to learn how to use Geomerative to achieve a specific effect. I want to map/grow an SVG path according to a unit value (0.0 - 1.0). This code works well, but I can’t change the style of the caps and joins for the path. Methods setStrokeCap() and setStrokeJoin() don’t return any error, but they don’t change the appearance of the ends and corners either.

SVG used in this test is available here.

Anyone good with Geomerative who could help me?

import geomerative.*;

RShape shp;

int first = 0;

void setup(){
  size(600, 600);
  smooth();

  // VERY IMPORTANT: Allways initialize the library before using it
  RG.init(this);
  color clr = color(255, 255, 255);
  shp = RG.loadShape("draw_1.svg");
  shp = RG.centerIn(shp, g, 100);
  shp.setStroke(clr);
  shp.setStrokeWeight(20.0);
  shp.setStrokeJoin("ROUND");
  shp.setStrokeCap("ROUND");
  shp.setAlpha(127);
  shp.setFill(false);
}

void draw(){
  translate(width/2, height/2);
  background(#2D4D83);

  noFill();
  stroke(255, 200);
  float splitPos = map(mouseX, 0, width, 0, 1);
  
  RShape[] splitShapes = RG.split(shp, splitPos);
  
  RG.shape(splitShapes[first]);
}
1 Like