p5实现线圈绘制一幅日出画作动画效果代码

代码语言:html

所属分类:动画

代码描述:p5实现线圈绘制一幅日出画作动画效果代码

代码标签: p5 线圈 绘制 日出 画作 动画

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


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">

  
  
  
  
<style>
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: black;
}
</style>


</head>

<body >
  


<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.1.4.0.js"></script>
      <script  >

//nothing special here - just hatching for images
//click to add hatching focal points and press any key to pause.
let fArray = []
let painting;//acrylic from a few years ago
let hatchSize = 100;//size of hatch
let hatchToggle = true;
let cx,cy;
let chatchSize = 1;
function preload(){
	bg = loadImage('//repo.bfw.wiki/bfwrepo/image/6250baee73985.png');;
}
function setup() {
  h = windowHeight*0.95;
	w=h*bg.width/bg.height;
  cnv = createCanvas(w,h);//canvas creation
	strokeWeight(0.5);
	cx=0.5*width;
	cy=0.427*height
	fArray[0] = createVector(cx,cy);
}
function draw() {
	if (hatchToggle){
 for(let i=0;i<10;i++){
   //classicHatch();
	 for(let j=0;j<fArray.length;j++){
	 	circleHatch(fArray[j].x,fArray[j].y)
	 }
 }
	//decrease hatch size
	if(hatchSize>5){
		hatchSize-=0.5;
	}
	}
}
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0