import processing.core.*; import processing.data.*; import processing.event.*; import processing.opengl.*; import java.util.HashMap; import java.util.ArrayList; import java.io.File; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; public class joonis1 extends PApplet { public void setup() { size(640, 360); noStroke(); colorMode(RGB, height, height, height); rectMode(CENTER); } public void draw() { background(0.0f); float r1 = map(mouseX, 0, width, 0, height); float r2 = height-r1; fill(r1); rect(width/2 + r1/2, height/2, r1, r1); fill(r2); rect(width/2 - r2/2, height/2, r2, r2); } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "joonis1" }; if (passedArgs != null) { PApplet.main(concat(appletArgs, passedArgs)); } else { PApplet.main(appletArgs); } } }