2013-09-28 1 views
1

저는이 문제에 대한 해결책을 찾기 위해 오랫동안 검색해 왔지만 처리 코드 자체에 문제가있을 것으로 예상합니다. 기본적으로 브라우저에서 스케치를 사용할 수 없습니다. 모든 드림위버는 내 스케치가 있어야하는 작은 회색 큐브를 보여줍니다. 큐브는 브라우저에도 없기 때문에 .pde 파일 자체의 참조 파일과 관련이 있습니다. 또한 Processing 2.0 및 processing.js 1.4.1을 사용하고 있습니다. Processing Sketch가 Processing.js에서 HTML로 작동하지 않습니다

내 HTML입니다 :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 


<meta charset="utf-8" /> 

<title>DreamSketcher</title> 
<link href="text.css" rel="stylesheet" type="text/css"> 
<script src="processing.js"></script> 


</head> 

<body> 
<canvas data-processing-sources="kringen.pde"> </canvas> 

</body> 
</html> 

그리고 이것은 'kringen.pde'라는 내 처리 파일입니다

/* @pjs preload="dreamtex.jpg"; */ 
//PImage utab=new PImage(320,200); 
//PImage vtab=new PImage(320,200); 


int [][] utab=new int [554][988]; 
int [][] vtab=new int [554][988]; 
int uoffs= int(0),voffs= int(0); 
int r = (int) random(1000,8192); 
int ra = (int) random(200,255); 
PImage tex; 


void setup() { 
size(554,988, JAVA2D); 
frameRate (22); 
precalc(); 
tex=loadImage("dreamtex.jpg"); 
println(tex.width); 

} 

void precalc() { 
int x,y,offs; 
float f; 
offs=0; 
for (y=0;y<988;y++) { 
for (x=0;x<554;x++) { 
f=8192/sqrt(pow((x-277),2)+pow((y-494),2)); 
//utab.pixels[offs]=color(int(f),int(f),int(f)); 
utab[x][y]=int(f)&255; 
f=128*atan2(y-494,x-277)/PI; 
//vtab.pixels[offs]=color(int(f),int(f),int(f)); 
vtab[x][y]=int(f)&255; 
offs++; 
} 
} 
} 

void draw() { 
loadPixels(); 
int x,y,offs,u,v; 
offs=0; 
for (y=0;y<988;y++) { 
for (x=0;x<554;x++) { 
u=(utab[x][y]+voffs)&ra; 
v=(vtab[x][y]+uoffs)&ra; 
pixels[offs++]=tex.pixels[(u<<8)+v]; 
} 
} 
updatePixels(); 
uoffs++; 
voffs++; 
} 
+2

해결 방법 : 코드가 로컬이고 링크되었을 때 시각적으로 반환 된 것을 볼 수 없습니다. 서버가 필요합니다. –

답변

0

이 코드는 한 모든 자원에로, 나를 위해 작동 place (pde 및 html 파일과 동일한 디렉토리에 있음) : processing.js, dreamtext.jpg 및 text.css.