mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Mouse 2D.
|
||||
*
|
||||
* Moving the mouse changes the position and size of each box.
|
||||
*/
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
noStroke();
|
||||
rectMode(CENTER);
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
background(51);
|
||||
fill(255, 204);
|
||||
rect(mouseX, height/2, mouseY/2+10, mouseY/2+10);
|
||||
fill(255, 204);
|
||||
int inverseX = width-mouseX;
|
||||
int inverseY = height-mouseY;
|
||||
rect(inverseX, height/2, (inverseY/2)+10, (inverseY/2)+10);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class Mouse2D extends PApplet {
|
||||
|
||||
/**
|
||||
* Mouse 2D.
|
||||
*
|
||||
* Moving the mouse changes the position and size of each box.
|
||||
*/
|
||||
|
||||
public void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
noStroke();
|
||||
colorMode(RGB, 255, 255, 255, 100);
|
||||
rectMode(CENTER);
|
||||
}
|
||||
|
||||
public void draw()
|
||||
{
|
||||
background(51);
|
||||
fill(255, 80);
|
||||
rect(mouseX, height/2, mouseY/2+10, mouseY/2+10);
|
||||
fill(255, 80);
|
||||
int inverseX = width-mouseX;
|
||||
int inverseY = height-mouseY;
|
||||
rect(inverseX, height/2, (inverseY/2)+10, (inverseY/2)+10);
|
||||
}
|
||||
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "Mouse2D" });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Mouse 2D.
|
||||
*
|
||||
* Moving the mouse changes the position and size of each box.
|
||||
*/
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
noStroke();
|
||||
colorMode(RGB, 255, 255, 255, 100);
|
||||
rectMode(CENTER);
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
background(51);
|
||||
fill(255, 80);
|
||||
rect(mouseX, height/2, mouseY/2+10, mouseY/2+10);
|
||||
fill(255, 80);
|
||||
int inverseX = width-mouseX;
|
||||
int inverseY = height-mouseY;
|
||||
rect(inverseX, height/2, (inverseY/2)+10, (inverseY/2)+10);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Reference in New Issue
Block a user