Hello everyone !
after a lot of research, I am asking for your help.
I draw a random Bezier inside an ellipse, but I would like this ellipse to be the limit of the drawing as well to avoid continuing the lines outside the ellipse.
the line stay inside.
Thank you in advance for your help.
int savedTime;
int totalTime = 500;
import processing.svg.*;
void setup() {
size(793, 793);
background(255);
savedTime = millis();
}
void draw() {
stroke(0);
strokeWeight(2); //Epaisseur ligne cercle
noFill(); // pas de rempliçage
beginRecord(SVG, "frame1.svg");
ellipse(396.5, 396.5, height, height);
//
float radc;
float radx; // Radius
float rady;
float angle1; // angle
float angle2; // angle
float angle3; // angle
float angle4; // angle
float x; // result
float y;
float x1; // result
float y1;
float x2;
float y2;
float x3; // result
float y3;
//
radx=396.5;
rady=396.5;
radc=175;
angle1= 0;
angle2= 180;
angle3= random(360);
angle4= random(360);
//
x=(radx*cos(radians(angle1)))+width/2;
y=(radx*sin(radians(angle1)))+height/2;
x1=(radx*cos(radians(angle2)))+width/2;
y1=(radx*sin(radians(angle2)))+height/2;
x2=(radc*cos(radians(angle3)))+width/2;
y2=(radc*sin(radians(angle3)))+height/2;
x3=(radc*cos(radians(angle3)))+width/2;
y3=(radc*sin(radians(angle4)))+height/2;
noFill();
int counter = 0;
while (counter < 10) {
int i = (40 + (counter * 15));
bezier(x-(i/7.0), y+i, x2-(i/2.0), y2-(i/2.0), x3+i, i+y3, x1-(i/7.0), y1+i);
counter += 1;
}
int passedTime = millis() - savedTime;
// Has five seconds passed?
if (passedTime > totalTime){
noLoop();
}
}