Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
olivia-wang-generative [2021/06/20 18:34] – olivia.wang | olivia-wang-generative [2021/06/29 01:39] (current) – renick | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Olivia' | + | ======Olivia |
+ | by [[olivia-wang|Olivia Wang]] | ||
< | < | ||
- | <iframe src=" | + | <iframe src=" |
</ | </ | ||
+ | |||
+ | ===== about my crazyDog.js ===== | ||
+ | |||
+ | For this class, I think the most difficult part is the beginning. Because at the beginning I have to learn many functions and try to understand how it works. This part will consume a lot of brainpower, but when I understand I get a lot of sense of accomplishment too. Also, after I learned many functions, I can start put to them together in different ways and that's my favorite part. The good points about that studying programming. I think for me the most useful part is study programming will train my logic skills, because programming itself is a completely rational existence. There are certain specifications for what to put in every place, so in the process I learned how to follow the instructions. | ||
+ | |||
+ | 對於這堂課程,我覺得最難的部分是一開始的時候,因為在一開始,我需要學習很多種功能,並且了解它們是如何運作的。在這個過程中會耗費掉許多腦力,但是當我了解了它們是如何運作的之後,我感受到了很多的成就感。此外,我學習了許多功能之後,我就可以開始以不同的方式將它們組合在一起,這是我最喜歡的部分。學習編程的優點,我覺得對我來說最有用的部分是學習編程會訓練我的邏輯能力,因為編程本身就是一種完全理性的存在,所以每個地方要放什麼都會有一定的規範,所以在這個過程中我學習到了如何按照規範一步一步完成一件事情。 | ||
+ | |||
+ | The animation code is released under the [[https:// | ||
+ | |||
+ | ===== the code for my crazyDog.js ===== | ||
< | < | ||
let x, y; | let x, y; | ||
function setup() { | function setup() { | ||
- | createCanvas(2000, 420); | + | createCanvas(1800, 780); |
x = width; | x = width; | ||
y = height / 2; | y = height / 2; | ||
} | } | ||
+ | |||
class Dog { | class Dog { | ||
- | constructor (fColor1, fColor2, nColor, eColor1, eColor2, Ecolor1, Ecolor2, Bcolor, bColor, tColor, rColor, lColor1, lColor2, lColor3, x, y) | + | constructor (fColor1, fColor2, nColor, eColor1, eColor2, Ecolor1, Ecolor2, Bcolor, bColor, tColor, rColor, lColor1, lColor2, lColor3, |
{ | { | ||
this.faceColor1 = fColor1; | this.faceColor1 = fColor1; | ||
Line 29: | Line 40: | ||
this.legColor2 = lColor2; | this.legColor2 = lColor2; | ||
this.legColor3 = lColor3; | this.legColor3 = lColor3; | ||
+ | this.flowerColor = fcolor; | ||
+ | this.flowerColor2 = fcolor2; | ||
this.x = x; | this.x = x; | ||
this.y = y; | this.y = y; | ||
} | } | ||
+ | |||
draw () { | draw () { | ||
//ear | //ear | ||
fill(color(this.earColor1)); | fill(color(this.earColor1)); | ||
- | arc(this.x+70, | + | arc(this.x+70, |
fill(color(this.earColor2)); | fill(color(this.earColor2)); | ||
- | square(this.x+100, | + | square(this.x+100, |
//legs | //legs | ||
fill(color(this.rotateColor)); | fill(color(this.rotateColor)); | ||
- | rect(this.x+90, | + | rect(this.x+90, |
fill(color(this.legColor1)); | fill(color(this.legColor1)); | ||
- | rect(this.x+98, | + | rect(this.x+98, |
fill(color(this.legColor2)); | fill(color(this.legColor2)); | ||
- | rect(this.x+160, | + | rect(this.x+160, |
fill(color(this.legColor3)); | fill(color(this.legColor3)); | ||
- | rect(this.x+170, | + | rect(this.x+170, |
//body | //body | ||
fill(color(this.bodyColor)); | fill(color(this.bodyColor)); | ||
- | rect(this.x+90 , this.y+280, 100, 55, 20); | + | rect(this.x+90 , this.y+610, 100, 55, 20); |
fill(color(this.bellyColor)); | fill(color(this.bellyColor)); | ||
- | rect(this.x+115 , this.y+320, 60, 15, 20); | + | rect(this.x+115 , this.y+650, 60, 15, 20); |
fill(color(this.tailColor)); | fill(color(this.tailColor)); | ||
- | ellipse(this.x+185 , this.y+260, 10, 55); | + | ellipse(this.x+185 , this.y+590, 10, 55); |
//face | //face | ||
fill(color(this.faceColor1)); | fill(color(this.faceColor1)); | ||
- | circle(this.x+94 ,this.y+260, 50); | + | circle(this.x+94 ,this.y+590, 50); |
fill(color(this.faceColor2)); | fill(color(this.faceColor2)); | ||
- | circle(this.x+94, | + | circle(this.x+94, |
//nose | //nose | ||
fill(color(this.noseColor)); | fill(color(this.noseColor)); | ||
- | circle(this.x+94, | + | circle(this.x+94, |
//eyes | //eyes | ||
fill(color(this.eyeColor1)); | fill(color(this.eyeColor1)); | ||
- | circle(this.x+105 , this.y+255, 10); | + | circle(this.x+105 , this.y+585, 10); |
fill(color(this.eyeColor1)); | fill(color(this.eyeColor1)); | ||
- | circle(this.x+80, | + | circle(this.x+80, |
fill(color(this.eyeColor2)); | fill(color(this.eyeColor2)); | ||
- | circle(this.x+105, | + | circle(this.x+105, |
fill(color(this.eyeColor2)); | fill(color(this.eyeColor2)); | ||
- | circle(this.x+80, | + | circle(this.x+80, |
+ | //flower | ||
+ | fill(color(this.flowerColor)); | ||
+ | circle(this.x+20, | ||
+ | fill(color(this.flowerColor)); | ||
+ | circle(this.x+30, | ||
+ | fill(color(this.flowerColor)); | ||
+ | circle(this.x+10, | ||
+ | fill(color(this.flowerColor)); | ||
+ | circle(this.x+25, | ||
+ | fill(color(this.flowerColor)); | ||
+ | circle(this.x+14, | ||
+ | fill(color(this.flowerColor)); | ||
+ | fill(color(this.flowerColor2)); | ||
+ | circle(this.x+20, | ||
} | } | ||
} | } | ||
- | + | ||
+ | |||
function dogArray (n) { | function dogArray (n) { | ||
let outputArray = []; | let outputArray = []; | ||
for (let i = 0; i < n ; i++) { | for (let i = 0; i < n ; i++) { | ||
- | outputArray.push(new Dog (" | + | outputArray.push(new Dog (" |
} | } | ||
return outputArray | return outputArray | ||
} | } | ||
- | + | ||
+ | |||
let myDogs = dogArray(15); | let myDogs = dogArray(15); | ||
// | // | ||
- | + | ||
+ | |||
class Background { | class Background { | ||
constructor(gColor, | constructor(gColor, | ||
Line 98: | Line 125: | ||
this.y = y; | this.y = y; | ||
} | } | ||
+ | |||
draw (){ | draw (){ | ||
- | //here | + | //sun |
- | noStroke(); | + | |
- | fill(color(this.groundColor)); | + | |
- | rect(x+this.x+0, | + | |
fill(color(this.sunColor)); | fill(color(this.sunColor)); | ||
- | circle(x+this.x+70, | + | circle(x+this.x+70, |
fill(color(this.cloudColor)); | fill(color(this.cloudColor)); | ||
//cloud | //cloud | ||
- | circle(x+this.x+240, this.y+110, 40); | + | circle(x+this.x+20, this.y+240, 70); |
fill(color(this.cloudColor)); | fill(color(this.cloudColor)); | ||
- | circle(x+this.x+260, this.y+120, 40); | + | circle(x+this.x+40, this.y+250, 70); |
fill(color(this.cloudColor)); | fill(color(this.cloudColor)); | ||
- | circle(x+this.x+220, this.y+130, 40); | + | circle(x+this.x+5, this.y+260, 70); |
fill(color(this.cloudColor)); | fill(color(this.cloudColor)); | ||
- | circle(x+this.x+250, this.y+140, 40); | + | circle(x+this.x+30, this.y+270, 70); |
fill(color(this.cloudColor)); | fill(color(this.cloudColor)); | ||
- | circle(x+this.x+280, this.y+120, 40); | + | circle(x+this.x+60, this.y+250, 70); |
strokeWeight(2); | strokeWeight(2); | ||
- | x = x - 1; | + | |
- | if (x < 0) { | + | |
- | x = width; | + | |
- | } | + | |
}} | }} | ||
- | + | ||
+ | |||
function BackgroundArray (n) { | function BackgroundArray (n) { | ||
let outputArray = []; | let outputArray = []; | ||
Line 132: | Line 153: | ||
return outputArray | return outputArray | ||
} | } | ||
- | + | ||
+ | |||
let myBackground = BackgroundArray(15); | let myBackground = BackgroundArray(15); | ||
// | // | ||
+ | |||
function draw () { | function draw () { | ||
- | background(" | + | background(frameCount %203, frameCount %245, frameCount %238); |
+ | |||
+ | | ||
+ | fill(color("green")); | ||
+ | rect(0, 700, width, 80); | ||
+ | |||
+ | x = (-3) * frameCount % width; | ||
+ | | ||
//let Background1 = new Background (" | //let Background1 = new Background (" | ||
// | // | ||
for(let i = 0; i < myBackground.length ; i++){ | for(let i = 0; i < myBackground.length ; i++){ | ||
myBackground[i].draw() | myBackground[i].draw() | ||
+ | |||
//let Dog1 = new Dog (10+(i*100), | //let Dog1 = new Dog (10+(i*100), | ||
// | // | ||
Line 150: | Line 178: | ||
} | } | ||
}} | }} | ||
+ | |||
</ | </ |