p5实现一个三维有限自动机效果代码
代码语言:html
所属分类:三维
代码描述:p5实现一个三维有限自动机效果代码,可旋转缩放
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
</head>
<body style="background-color:rgb(0,0,0);">
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.js"></script>
<script >
//up and down change the rules for life
//spacebar will change the number of nodes
//edges and dead/alive are random initially
//doodle code for mathober "rule" prompt (needs cleanup)
//the last rule is just death
//i have many more complex rules in mind, but don't have time to do this all in one day.
let n = 50;
let r = 200;
let rule = 6;
let nodeArray = [];
let edgeArray = [];
let neighborArray = [];
let nRules = 8;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
r = min(width, height) / 2.5;
angleMode(DEGREES);
initializeNodes();
initializeEdges();
//frameRate(1);
background(.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0