![](/img/trans.png)
[英]I want to know how to store some data in Matlab which I can later call from Java code?
[英]I want to know how you can run Processing Code in Eclipse
我所擁有的橢圓形用於繪制月亮,而其他所有表示填充的顏色則用於不同的顏色。 基本上,我的代碼在黑色背景上動畫了不同顏色的移動星,下面是白色的月亮
void setup() { //only runs once
fullScreen();
}
void draw(){
{
// black background
fill (255);
// white circle(x,y,height,width)
ellipse(800, 500, 500, 500);
}
{
//WHITE
fill(0, 9);
rect(0,0,width,height);
fill(255);
noStroke();
ellipse(random(width),random(height),3,3);
//GREEN
fill(0,9);
rect(0,0,width,height);
fill(0,250,9);
noStroke();
ellipse(random(width),random(height),5,5);
//PURPLE
fill(0,9);
rect(0,0,width,height);
fill(250,0,250);
noStroke();
ellipse(random(width),random(height),5,5);
//BLUE
fill(0,9);
rect(0,0,width,height);
fill(0,255,255);
noStroke();
ellipse(random(width),random(height),5,5);
}
}
處理可以用作Java庫,然后可以從Eclipse中使用它,就像可以使用任何其他Java庫一樣。
但是,您必須稍微修改代碼,因為您會丟失處理編輯器為您完成的“魔術”。 具體來說,您必須創建一個擴展PApplet
的類並將代碼放入其中。
在嘗試移植整個草圖之前,請先做一些簡單的工作。
這是一個例子:
import processing.core.PApplet;
public class MySketch extends PApplet {
public void settings() {
size(500, 500);
}
public void draw(){
background(64);
ellipse(mouseX, mouseY, 20, 20);
}
public static void main(String[] passedArgs) {
String[] appletArgs = new String[] { "MySketch" };
PApplet.main(appletArgs);
}
}
無恥的自我推廣: 這是有關將Processing用作Java庫的指南。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.