# 期中報告 410730872王宣閔 ![](https://i.imgur.com/s3os4W1.png) ```javascript= function setup() { createCanvas(windowWidth, windowHeight); background(0); } function draw() { background(0); var count = 0 for(var x=0; x<width;x=x+200){ for(var y=0; y<height;y=y+200){ //讓圖形充滿版面for迴圈 count=count+1 strokeWeight(3) noFill() stroke(255,0,0) ellipse(100+x,100+y,200+map(mouseX,0,width,0,200)) stroke(0,255,0) rect(2+x,2+y,200+map(mouseX,0,width,0,200)) stroke(0,0,255) ellipse(200+x,200+y,100+map(mouseX,0,width,0,200)) } } } ``` 作業二 ![](https://i.imgur.com/e35Nk2Q.png) ```javascript=function function preload(){ catImg=loadImage("main.png"); } function setup() { createCanvas(windowWidth, windowHeight); background(0); } function draw() { background("#FF7575") imageMode(CENTER) noFill() strokeWeight(2) for(var i=0;i<width;i=i+150){ for(var j=0;j<height;j=j+150){ //讓圖形充滿版面for迴圈 var c =map(mouseX, 0, width, 0, 25); //動滑鼠 ellipse(mouseX, mouseY, 20, 20); stroke("#4DFFFF") ellipse(i+25,j+25,50+abs(sin(frameCount/20)*50)) //ellipse(i+25,j+25,50)//大圓 rectMode(CENTER); stroke("#81C0C0") rect(i,j,50) //改變成圓形 stroke("#E2C2DE") ellipse(i+50,j+50,25+abs(sin(frameCount/20)*50)) //ellipse(i+50,j+50,25)//小圓 imageMode(CENTER)//滑鼠置中 image(catImg,i,j,100,100); //改變大小 } } }