• 00:00 1.
    Chapter 4 Functions
  • 索引
  • 筆記
  • 討論
  • 全螢幕
Chapter 4 Functions
長度: 33:47, 瀏覽: 293, 最近修訂: 2022-09-16

C4-1 Scratch裡的Function

摘要
  • 流程圖(Flowchat)介紹。
  • Scratch的每一個積木都是一個Function。
  • Scratch的Addons: Pen, Music。
     

C4-2 Processing裡的Function

摘要
  • void setup() 與 void draw()。
  • beginShape() 與 endShape()。
  • map(value, start1, stop1, start2, stop2)。
     
    範例程式
    void setup(){
    size(480, 120);
    }
    void draw(){
    println(mouseX, mouseY);
    // Background
    background(200-mouseY);
    // Sun
    fill(255,0,0);
    circle(width/2, mouseY, 50);
    // Ground
    fill(5,250,64);
    rect(0, 80, width, 40);
    // Left creature
    beginShape();
    fill(5,186,250);
    vertex(50, 120);
    vertex(100, 90);
    vertex(110, 60);
    vertex(80, 20);
    vertex(210, 60);
    vertex(160, 80);
    vertex(200, 90);
    vertex(140, 100);
    vertex(130, 120);
    endShape();
    fill(0);
    circle(155, 60, 8);
    // Right creature
    fill(250,165,5);
    beginShape();
    vertex(370, 120);
    vertex(360, 90);
    vertex(290, 80);
    vertex(340, 70);
    vertex(280, 50);
    vertex(420, 10);
    vertex(390, 50);
    vertex(410, 90);
    vertex(460, 120);
    endShape();
    fill(0);
    circle(345, 50, 10);
    }
     
    位置
    資料夾名稱
    程式設計與應用
    發表人
    系統管理者
    單位
    影音網 (root)
    建立
    2022-09-06 13:25:45
    最近修訂
    2022-09-16 15:31:28
    長度
    33:47