上矢印で拡大、下矢印で縮小、TABで固定されます。
(privacy2.htmlファイル)
<html><head>
<script language="javascript" type="text/javascript" src="libraries/p5.js"></script>
<script language="javascript" type="text/javascript" src="privacy2.js"></script>
</head><body></body></html>
(privacy2.jsファイル)
var j=0; var A=1; var glass=[]; var X=[]; var Y=[];
function preload() {
img = loadImage("ario2.jpg")
}
function setup() {
createCanvas(1000, 800);
}
function draw() {
background(240);
image(img, 100, 100, 800, 600); // tint(255, 150);
glass[0]=A; X[0]=mouseX; Y[0]=mouseY;
for(var i = 0;i<glass.length;i++){
fill(0,0,0); noStroke();
ellipse(X[i]-12*glass[i], Y[i]-25, 30*glass[i], 20*glass[i]);
ellipse(X[i]+12*glass[i], Y[i]-25, 30*glass[i], 20*glass[i]);
fill(100); ellipse(X[i]+12*glass[i], Y[i]-28, 7*glass[i], 7*glass[i]);
fill(200); ellipse(X[i]+12*glass[i], Y[i]-28, 3*glass[i], 3*glass[i]);
}
textSize(32);
text("懇親会", 100, 50);
}
function keyPressed() {
if (keyCode == UP_ARROW) {
A=A*1.2;
} else if (keyCode == DOWN_ARROW) {
A=A*0.9;
} else if (keyCode == TAB) {
j+=1; glass[j]=A; X[j]=mouseX; Y[j]=mouseY;
}
}