processingjs使用java来编写浏览器canvas 2d 3d动画效果代码

代码语言:html

所属分类:动画

代码描述:processingjs使用java来编写浏览器canvas 2d 3d动画效果代码,processingjs把基于Java的Processing表述,转化为JavaScript代码,利用HTML5的canvas api,在浏览器上执行

代码标签: 编写 浏览器 canvas 2d 3d 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
<title>Processing.js Test</title>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/processing.min.js"></script>
<script type="application/processing" data-processing-target="pjs">

int i = 0;
void setup() {
	size(200, 200);
	frameRate(24);
	background(255);
	strokeWeight(15);
	smooth();
}
void draw() {
	stroke(random(50), random(255), random(255), 100);
	line(i++, 0, random(0, width), height);
	if (i >= width) i = 0;
}
void mousePressed() {
	background(255);
	redraw();
}
</script>
<script type="application/processing" data-processing-target="pjs2">

float ang = 0, ang2 = 0, ang3 = 0, ang4 = 0;
float px = 0, py = 0, pz = 0;
float flapSpeed = 0.2;
void setup(){
	size(200, 200, P3D);
	frameRate(30);
	noStroke();
}
void draw(){
	background(0);
	camera();
	//.........完整代码请登录后点击上方下载按钮下载查看

网友评论0