mirror of
https://github.com/processing/processing4.git
synced 2026-02-10 00:59:40 +01:00
32 lines
486 B
Plaintext
32 lines
486 B
Plaintext
// Sine Wave
|
|
// Daniel Shiffman <http://www.shiffman.net>
|
|
|
|
|
|
// Two wave objects
|
|
Wave wave0;
|
|
Wave wave1;
|
|
|
|
void setup() {
|
|
size(640,360);
|
|
smooth();
|
|
// Initialize a wave with starting point, width, amplitude, and period
|
|
wave0 = new Wave(new PVector(200,75),100,20,500);
|
|
wave1 = new Wave(new PVector(150,250),300,40,220);
|
|
|
|
}
|
|
|
|
void draw() {
|
|
background(255);
|
|
|
|
// Update and display waves
|
|
wave0.calculate();
|
|
wave0.display();
|
|
|
|
wave1.calculate();
|
|
wave1.display();
|
|
|
|
|
|
}
|
|
|
|
|