// Line void setup() { size(640,480); background(255); //white } void draw(){ stroke(0); line(0,479, 639, 0); } //————————————– // Bounce Ball float x = 100; float y = 100; float xspeed = 1; float yspeed = 3.3; void setup(){ size(640, 480); smooth(); background(255); } void draw(){ background(255); x = x + xspeed; y = y + yspeed; if((x > width)||(x height)..
// 화면에서 노이즈 발생시 offset 값을 조정하여 질감의 조정 void setup() { size(640,408); background(255); //white } void draw(){ loadPixels(); float xoff=0.0; for(int x = 0; x < width; x++) { float yoff=0.0; for(int y= 0; y < height; y++) { float bright = map(noise(xoff,yoff), 0,1, 0,255); //float bright = random(255); pixels[x+y*width]=color(bright); yoff += 0.01; } xoff += 0.01; } updatePixels(); } //—————————————..
nature of code : shiffman 코드 사이트 : https://github.com/shiffman/The-Nature-of-Code-Examples 프로세싱 언어 입문서 : https://processing.org/learning/books 프로세싱 언어 다운로드 : https://processing.org/download 프로세싱 언어 Get Start : https://processing.org/tutorials/gettingstarted Getting start with processing sample : https://processing.org/books/media.zip !. Hello, World! println(“Hello,World”); !. Hello, World! void..
//-------------------------- // Boxes.pde import shiffman.box2d.*; import org.jbox2d.collision.shapes.*; import org.jbox2d.common.*; import org.jbox2d.dynamics.*; import java.util.ArrayList; Box2DProcessing box2d; ArrayList boxes; Surface surface; void setup(){ size(640, 480); box2d = new Box2DProcessing(this); box2d.createWorld(); boxes = new ArrayList(); surface = new Surface(); } void draw(){..
// Box.pde class Box{ Body body; // Box2D Object(World, Body, Fixture, Shape float w, h; //weight, height Box(){ w = 16; h = 16; // 1. create bodyDef BodyDef bd = new BodyDef(); bd.type = BodyType.DYNAMIC; bd.position.set(box2d.coordPixelsToWorld(mouseX, mouseY)); // 2. define body body = box2d.createBody(bd); // 3. create Shape PolygonShape ps = new PolygonShape(); float box2DW = box2d.scalarPi..
// Box.pde class Box{ Body body; // Box2D Object(World, Body, Fixture, Shape float w, h; //weight, height Box(){ w = 16; h = 16; // 1. create bodyDef BodyDef bd = new BodyDef(); bd.type = BodyType.DYNAMIC; bd.position.set(box2d.coordPixelsToWorld(mouseX, mouseY)); // 2. define body body = box2d.createBody(bd); // 3. create Shape PolygonShape ps = new PolygonShape(); float box2DW = box2d.scalarPi..
물리엔진라이브러리를 만들어 보자.. Box2D는 2006년 게임개발자 회의에서 에린 카토(Erin Catto)가 물리 관련 튜토리얼로 발표한 C++ 코드에서 출발했습니다.(http://box2d.org/about/) Java로 구현된 JBox2D 라이브러리를 설치 필요(http://www.jbox2d.org/) 추가로 PBox2D(프로세싱 Box2D) 설치 필요 아래 사이트 : https://github.com/shiffman/Box2D-for-Processing 그러나 프로세싱에서 사용하기 위해서는 Processing > Sketch 메뉴에서 >라이브러리 > 라이브러리 추가하기 메뉴에서 jbox2D를 선택하고 shiffman의 라이브러리를 설치해 주어야 한다. 위와 같이 설치가 불가할 경우 manual..