p5实现延龄草效果代码
代码语言:html
所属分类:布局界面
代码描述:p5实现延龄草效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> </head> <body > <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.js"></script> <script> //click for a new trillium function setup(){ createCanvas(600,600); angleMode(DEGREES); background(60,60,60); } function draw(){ background(60,60,60,0.5); strokeWeight(2) translate(width/2,width/2); trillium(1) } function genLeaf(s){ fill(83, 140, 100); stroke(47, 74, 55); beginShape(); for(let i=0;i<180;i++){ y=i; x=s*sin(i); vertex(x,y); } for(let i=180;i>=0;i--){ y=i; x=-s*sin(i); vertex(x,y); } endShape(CLOSE); beginShape(); for(let i=0;i<180;i++){ y=i; x=s/2*sin(i); vertex(x,y); } for(let i=180;i>=0;i--){ y=i; x=-s/2*sin(i); vertex(x,y); } endShape(CLOSE); line(0,0,0,180).........完整代码请登录后点击上方下载按钮下载查看
网友评论0