header

 

More links

Adobe Connect | Adobe Conect Custom Pods | AutoHotkey | Android | Arduino | Blog | COMM140Fractals | Grammar Checkers | Knots | a Million Dots |  Processing | RedBubble | Tutorials | Weather | World Time Meeting Planner |

Home > Tutorials > Processing > Processing Examples > Lissajous 7

Lissajous 7

Lissajous

See http://en.wikipedia.org/wiki/Lissajous_curve

Lissajous Code

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

code formatter

 


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

Last refreshed: October 22 2017. 05:31.30 pm

rupert dot russell at acu dot edu dot au Support Wikipedia

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.


1546 visits since March 27, 2011