AutoHotkey | Android | Arduino | COMM140 | Fractals | Grammar Checkers | Knots | A Million Dots Activity | Processing | Processing for Scratch Users | Redbubble | Tutorials | Weather | World Time Meeting Planner | Favicon Generator.
Home > Tutorials > Processing > Processing Examples > Lissajous 7
// 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"); }
APA citation:
Russell, R. (2016, July 05, 07:26 am). Lissajous 7.
Retrieved December 22, 2024, from http://www.rupert.id.au/tutorials/processing/examples/scintillating.php
Last refreshed: December 22 2024. 08:18.28 pm
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.