zdog绘制一个三维奔跑中男女卡通效果代码
代码语言:html
所属分类:三维
代码描述:zdog绘制一个三维奔跑中男女卡通效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> html { height: 100%; } body { min-height: 100%; margin: 0; display: flex; align-items: center; justify-content: center; background: #09D; font-family: sans-serif; text-align: center; } canvas { display: block; margin: 0px auto 20px; cursor: move; } a { color: white; } a:hover { color: #606; } button { background: #848; color: white; font-size: 14px; font-family: inherit; border: none; border-radius: 3px; padding: 8px 10px; } button:hover { background: #606; cursor: pointer; } </style> </head> <body > <div class="container"> <canvas class="illo"></canvas> <p><a >Original illustration by Robin Davey</a></p> <p><button class="reset-button">Reset</button></p> </div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/zdog.dist.js"></script> <script > // Made with Zdog var illoElem = document.querySelector('.illo'); var illoSize = 128; var minWindowSize = Math.min(window.innerWidth - 20, window.innerHeight - 60); var zoom = Math.floor(minWindowSize / illoSize); illoElem.setAttribute('width', illoSize * zoom); illoElem.setAttribute('height', illoSize * zoom); var isSpinning = true; var TAU = Zdog.TAU; var sceneStartRotation = { y: -TAU / 8 }; var illo = new Zdog.Illustration({ element: illoElem, zoom: zoom, rotate: sceneStartRotation, dragRotate: true, onDragStart: function () { isSpinning = false; } }); var quarterTurn = Math.sin(TAU / 8); // ----- colors ----- // var beigeDark = '#F96'; var beigeLight = '#FC9'; var skinDark = '#F66'; var skinMedium = '#F88'; var skinLight = '#FAA'; var navy = '#036'; var midnight = '#003'; var auburn = '#903'; var red = '#C33'; var sky = '#09D'; var offWhite = '#FFD'; var white = 'white'; var blueDark = '#66C'; var bluePale = '#CCF'; // -- models --- // var ground = new Zdog.Anchor({ addTo: illo, translate: { y: 56 } }); // ----- dude ----- // (function () { var dude = new Zdog.Anchor({ addTo: ground, translate: { x: -24, z: -12 } }); var hipX = 8 / quarterTurn / 2; var hips = new Zdog.Shape({ path: [ { x: -hipX }, { x: hipX }], addTo: dude, translate: { y: -49 }, rotate: { x: TAU / 16 }, stroke: 8, color: beigeLight }); // right thigh var rightThigh = new Zdog.Shape({ path: [ { y: 0 }, { y: 18 }], addTo: hips, translate: { x: -hipX }, stroke: 8, color.........完整代码请登录后点击上方下载按钮下载查看
网友评论0