xxxxxxxxxx
/*@pjs preload="kabo.png, D.png, A.png, I.png,C.png, H.png, I2.png";*/
int eSize = 3; //星の直径
int Dy= 260; //画像のY座標↓
int Ay = 310;
int Iy = 270;
int Cy = 310;
int Hy = 260;
int I2y = 300;
int yspeed = 1; //アニメーションのスピード↓
int yspeed2 = -2;
int yspeed3 = 3;
int R = 0; //色の変数↓
int G = 0;
int B = 80;
int cspeed = 10; //カラースピード↓
int cspeed2 = 7;
PImage img; //画像の変数↓
PImage imgD;
PImage imgA;
PImage imgI;
PImage imgC;
PImage imgH;
PImage imgI2;
void setup() {
size(500, 400);
noStroke();
smooth();
frameRate(20); //フレームレート20
}
void draw() {
background(0, 0, 80); //背景
img = loadImage("kabo.png"); //かぼちゃ
image(img, 40, Dy, 70, 70); //かぼちゃの座標↓
image(img, 100, Ay, 70, 70);
image(img, 173, Iy, 70, 70);
image(img, 240, Cy, 70, 70);
image(img, 310, Hy, 70, 70);
image(img, 380, I2y, 70, 70);
fill(0, 90, 0); //木の色
ellipse(0, 0, 300, 300); //木の座標↓
ellipse(0, 100, 150, 200);
ellipse(500, 0, 250, 200);
ellipse(500, 100, 100, 200);
ellipse(500, 70, 200, 200);
fill(255, 255, 0); //月の色
ellipse(300, 50, 60, 60); //月の座標
fill(0, 0, 80); //月の欠けているところの円の色(=背景色)
ellipse(290, 40, 40, 40); //月の欠けているところの円の座標
if(key == CODED){
if(keyCode == SHIFT){ //Shiftキーによるキーイベント
fill(R, G, B); //星の色
ellipse(183, 50, eSize, eSize); //星の座標↓
ellipse(89, 180, eSize, eSize);
ellipse(259, 176, eSize, eSize);
ellipse(347, 105, eSize, eSize);
ellipse(130, 100, eSize, eSize);
ellipse(170, 129, eSize, eSize);
ellipse(400, 170, eSize, eSize);
ellipse(210, 90, eSize, eSize);
ellipse(300, 110, eSize, eSize);
ellipse(200, 200, eSize, eSize);
ellipse(430, 200, eSize, eSize);
ellipse(300, 180, eSize, eSize);
R += cspeed; //R,Gの色彩のアニメーション↓
G += cspeed;
if(R < 0 || G < 0){
cspeed = -cspeed;
R = 0;
G = 0;
}
else if(R > 255 || G > 255){
cspeed = -cspeed;
R = 255;
G = 255;
}
B += cspeed2; //Bの色彩のアニメーション
if(B < 80){
cspeed2 = -cspeed2;
B = 80;
}
else if(B > 255){
cspeed2 = -cspeed2;
B = 255;
}
imgD = loadImage("D.png"); //文字の画像を表示↓
imgA = loadImage("A.png");
imgI = loadImage("I.png");
imgC = loadImage("C.png");
imgH = loadImage("H.png");
imgI2 = loadImage("I2.png");
image(imgD, 40, Dy - 70, 70, 70); //文字の座標↓
image(imgA, 100, Ay - 70, 70, 70);
image(imgI, 173, Iy - 70, 70, 70);
image(imgC, 240, Cy - 70, 70, 70);
image(imgH, 310, Hy - 70, 70, 70);
image(imgI2, 380, I2y - 70, 70, 70);
Dy = Dy + yspeed; //文字のアニメーション↓
Ay = Ay + yspeed2;
Iy = Iy + yspeed;
Cy = Cy + yspeed3;
Hy = Hy + yspeed3;
I2y = I2y + yspeed2;
if(Dy < 255 || Dy > 265 ||
Ay < 305 || Ay > 315 ||
Iy < 265 || Iy > 275 ||
Cy < 305 || Cy > 315 ||
Hy < 255 || Hy > 265 ||
I2y < 295 || I2y > 305){
yspeed = -yspeed;
yspeed2 = -yspeed2;
yspeed3 = -yspeed3;
}
}
}
}