Home > Tutorials > Processing > Processing Examples > Lissajous 7

# Lissajous 7

#### processing code

```// Draws a Lissajous figures
// Based on code by Javier Romero
// http://www.fjromero.com/processing/lissajous/

// 27 March 2011
// http://www.rupert.id.au/tutorials/processing/examples.php

int screen_width = 606;
int screen_height = 625;

/* Scale image and reduce by 10 pixels to remove from edge of screen */
int AX = (screen_width/2) - 10;
int BX = (screen_height/2) - 10;

/* Try different values for a & b */
// eg a=1, b=3; a=1, b=2; a = 3, b = 4; a=9, b=8;

float a = 1.7;
float b = 1.8;
float delta = PI/2;

float x, y;
float t=10;
float inc_t = 0.01;

void setup(){
smooth();
fill(255);
size(screen_width,screen_height);
}

void draw(){
// background(0);
x = AX*sin(a*t + delta) + screen_width/2;
y = BX*sin(b*t) + screen_height/2;

fill(#ffff00);
ellipse(x,y,1,1);

t = t+inc_t;
}

// Save tif when mouse is clicked
void mouseClicked(){
noLoop();
save("lissa_7.tif");
}```

code formatter

APA citation:
Russell, R. (2016, July 05, 07:26 am). Lissajous 7.
Retrieved June 24, 2024, from http://www.rupert.id.au/tutorials/processing/examples/scintillating.php

Last refreshed: June 24 2024. 10:43.30 am