processing实现三维树生长旋转动画效果代码
代码语言:html
所属分类:三维
代码描述:processing实现三维树生长旋转动画效果代码,拖动鼠标可旋转树
代码标签: processing 三维 树 生长 旋转 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Dosis&display=swap"); * { box-sizing: border-box; } body { width: 100%; height: 100vh; margin: 0; padding: 0; font-family: "Dosis", sans-serif; overflow: hidden; background-color: #e6e2ca; display: flex; justify-content: center; align-items: center; } body .container { padding: 0; margin: 0; margin: auto; min-height: 100%; max-width: 900px; overflow: hidden; box-shadow: 0.02em 0.02em 1.5em #0005; } body .container canvas { outline: none; } </style> </head> <body > <main> <div class="container"> <canvas class="program"></canvas> </div> </main> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/processing.min.js"></script> <script > const programArr = [ (processingInstance) => { with (processingInstance) { size(700, 600, P2D); frameRate(60); smooth(); textAlign(CENTER, CENTER); textSize(25); strokeCap(PROJECT); //the tree object let tree; //used to keep track of the rotation let theta = 0; //used for controlling the animation let len = 0; //determines if the user is currently dragging the mouse let dragging = false; //define the tree object/properties tree = { x: 0, y: 0, len: 100, depth: 6, .........完整代码请登录后点击上方下载按钮下载查看
网友评论0