mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 11:21:06 +01:00
Removing old examples for 2.0
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* Sprite (Teddy)
|
||||
* by James Patterson.
|
||||
*
|
||||
* Demonstrates loading and displaying a transparent GIF image.
|
||||
*/
|
||||
|
||||
PImage teddy;
|
||||
|
||||
float x, y;
|
||||
float easing = 0.05;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
imageMode(CENTER);
|
||||
teddy = loadImage("teddy.gif");
|
||||
x = width/2;
|
||||
y = height/2;
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(102);
|
||||
|
||||
float dx = mouseX - x;
|
||||
x += dx * easing;
|
||||
x = constrain(x, teddy.width/2, width - teddy.width/2);
|
||||
|
||||
float dy = mouseY - y;
|
||||
y += dy * easing;
|
||||
y = constrain(y, teddy.height/2, height - teddy.height/2);
|
||||
|
||||
// Display the sprite at the position x, y
|
||||
image(teddy, x, y);
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 746 B |
Reference in New Issue
Block a user