olivia-wang-generative

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
olivia-wang-generative [2021/06/22 18:46] olivia.wangolivia-wang-generative [2021/06/29 01:39] (current) renick
Line 1: Line 1:
-=====Olivia Wang's crazyDog.js=====+======Olivia Wang's crazyDog.js=====
 +by [[olivia-wang|Olivia Wang]]
 <HTML> <HTML>
-<iframe src="https://editor.p5js.org/olivia.wang/present/q9s4QHH31" width=99% height=799px></iframe>+<iframe src="https://editor.p5js.org/renick/present/ZxdfB2dgx" width=99% height=799px></iframe>
 </HTML> </HTML>
  
Line 9: Line 10:
  
 對於這堂課程,我覺得最難的部分是一開始的時候,因為在一開始,我需要學習很多種功能,並且了解它們是如何運作的。在這個過程中會耗費掉許多腦力,但是當我了解了它們是如何運作的之後,我感受到了很多的成就感。此外,我學習了許多功能之後,我就可以開始以不同的方式將它們組合在一起,這是我最喜歡的部分。學習編程的優點,我覺得對我來說最有用的部分是學習編程會訓練我的邏輯能力,因為編程本身就是一種完全理性的存在,所以每個地方要放什麼都會有一定的規範,所以在這個過程中我學習到了如何按照規範一步一步完成一件事情。 對於這堂課程,我覺得最難的部分是一開始的時候,因為在一開始,我需要學習很多種功能,並且了解它們是如何運作的。在這個過程中會耗費掉許多腦力,但是當我了解了它們是如何運作的之後,我感受到了很多的成就感。此外,我學習了許多功能之後,我就可以開始以不同的方式將它們組合在一起,這是我最喜歡的部分。學習編程的優點,我覺得對我來說最有用的部分是學習編程會訓練我的邏輯能力,因為編程本身就是一種完全理性的存在,所以每個地方要放什麼都會有一定的規範,所以在這個過程中我學習到了如何按照規範一步一步完成一件事情。
 +
 +The animation code is released under the [[https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html|GNU Lesser General Public License v2.1]].
  
 ===== the code for my crazyDog.js ===== ===== the code for my crazyDog.js =====
Line 19: Line 22:
   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,fcolor,fcolor2, x, y)   constructor (fColor1, fColor2, nColor, eColor1, eColor2, Ecolor1, Ecolor2, Bcolor, bColor, tColor, rColor, lColor1, lColor2, lColor3,fcolor,fcolor2, x, y)
Line 42: Line 45:
     this.y = y;     this.y = y;
   }   }
 + 
   draw () {   draw () {
     //ear     //ear
Line 98: Line 101:
   }   }
 } }
- +  
 + 
 function dogArray (n) { function dogArray (n) {
     let outputArray = [];     let outputArray = [];
Line 107: Line 110:
     return outputArray     return outputArray
 } }
- +  
 + 
 let myDogs = dogArray(15); let myDogs = dogArray(15);
 //console.log(myDogs); //console.log(myDogs);
- +  
 + 
 class Background { class Background {
   constructor(gColor, Scolor, cColor, x, y)   constructor(gColor, Scolor, cColor, x, y)
Line 122: Line 125:
   this.y = y;   this.y = y;
 } }
 + 
   draw (){   draw (){
-    //here 
-    noStroke(); 
-    fill(color(this.groundColor)); 
-    rect(x+this.x+0, this.y+700, 400, 80); 
     //sun     //sun
     fill(color(this.sunColor));     fill(color(this.sunColor));
Line 143: Line 142:
   circle(x+this.x+60, this.y+250, 70);   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 157: Line 153:
     return outputArray     return outputArray
 } }
- +  
 + 
 let myBackground = BackgroundArray(15); let myBackground = BackgroundArray(15);
 //console.log(myBackground); //console.log(myBackground);
 + 
 function draw () { function draw () {
-  background("lightblue");+  background(frameCount %203, frameCount %245, frameCount %238); 
 +   
 +   noStroke(); 
 +    fill(color("green")); 
 +    rect(0, 700, width, 80); 
 +   
 +    x = (-3) * frameCount % width; 
 +  
   //let Background1 = new Background ("green", "yellow", "white", 20, 10);   //let Background1 = new Background ("green", "yellow", "white", 20, 10);
   //Background1.draw();   //Background1.draw();
   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), 20+(i*100), "red", "lightblue", "green", Math.random()*255, "pink", Math.random()*255, "purple", "yellow", "orange", Math.random()*255, "lightpink", "blue", "lightgreen", Math.random()*255, 10, 20);   //let Dog1 = new Dog (10+(i*100), 20+(i*100), "red", "lightblue", "green", Math.random()*255, "pink", Math.random()*255, "purple", "yellow", "orange", Math.random()*255, "lightpink", "blue", "lightgreen", Math.random()*255, 10, 20);
   //Dog1.draw();   //Dog1.draw();
  • olivia-wang-generative.1624412814.txt.gz
  • Last modified: 2021/06/22 18:46
  • by olivia.wang