Processing 初體驗 – 結合Android手機

Processing 互動程式初體驗 –

1. 手指頭接觸點會有一個白色小圓圈, 畫面中的正方形會隨著手指頭移動而旋轉。
boxRotation += (float)(pmouseX – mouseX)/100;
rotate(boxRotation);
rect(0, 0, 150, 150);

2. 觸碰點與畫面中心連線, line(width/2, height/2, mouseX, mouseY);

3.背景顏色也會隨著坐標而改變 background(mouseX * (255.0/800), mouseY * (255.0/280), 0);

要轉換到Android上執行只要切換到Android mode就好了, 電腦上必須要有Android SDK, 並裝好您Android手機的driver就可以了。 相當輕鬆。


================================================================

float boxRotation = 0;

void setup(){
size(480, 800);
smooth();
stroke(255);
fill(255);
rectMode(CENTER);

};

void draw(){
background(mouseX * (255.0/800), mouseY * (255.0/280), 0);
boxRotation += (float)(pmouseX – mouseX)/100;

line(width/2, height/2, mouseX, mouseY);
ellipse(mouseX, mouseY, 40, 40);
pushMatrix();
translate(width/2, height/2);
rotate(boxRotation);
rect(0, 0, 150, 150);
popMatrix();
};

About CAVEDU 阿吉 - 雜工 (2520 Articles)
CAVEDU 教育團隊 打雜
Contact: Website

Leave a comment

Your email address will not be published.


*