matter实现自由落体重力下落的导航菜单效果代码
代码语言:html
所属分类:菜单导航
代码描述:matter实现自由落体重力下落的导航菜单效果代码
代码标签: matter 自由 落体 重力 下落 导航 菜单
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/normalize.css"> <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Roboto&display=swap'> <style> html, body { height: 100%; font: 400 100%/1.25 "Roboto", sans-serif; } .playground { font: 400 100%/1 "Inter", sans-serif; background-color: #778beb; width: 100vw; height: 100vh; overflow: hidden; position: fixed; } #helper { position: fixed; width: 100vw; height: 100vh; pointer-events: none; opacity: 0; visibility: hidden; z-index: -1; } .menu__item { background-color: #f7d794; border: 3px solid #f5cd79; border-radius: 1.5em; box-shadow: inset 0 0 0 0.1em currentColor; font-size: 1.15rem; position: absolute; } .menu__item:hover { background-color: #f5cd79; } .menu__link { color: #303952; text-decoration: none; display: block; padding: 0.75em 3em; text-align: center; line-height: 1; } </style> </head> <body translate="no"> <section id="container" class="playground"> <ul class="menu"> <li class="menu__item"> <a href="#1" class="menu__link"> Music </a> </li> <li class="menu__item"> <a href="#2" class="menu__link"> Films </a> </li> <li class="menu__item"> <a href="#3" class="menu__link"> Theatre </a> </li> <li class="menu__item"> <a href="#4" class="menu__link"> Exhibitions </a> </li> <li class="menu__item"> <a href="#5" class="menu__link"> Talks </a> </li> <li class="menu__item"> <a href="#6" class="menu__link"> Performance </a> </li> <li class="menu__item"> <a href="#7" class="menu__link"> Workshops </a> </li> <li class="menu__item"> <a href="#8" class="menu__link"> Dance </a> </li> <li class="menu__item"> <a href="#9" class="menu__link"> Comedy </a> </li> <li class="menu__item"> <a href="#10" class="menu__link"> Contest </a> </li> <li class="menu__item"> <a href="#11" class="menu__link"> Food </a> </li> </ul> </section> <canvas id="helper"></canvas> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/matter.0.20.0.js"></script> <script > (function () { const WALL_THICKNESS = 80; // The helper needs to be the size of the container const MATTER_CONTAINER = document.querySelector("#container"); const MATTER_HELPER = document.querySelector("#helper"); let Engine = Matter.Engine, Render = Matter.Render, Runner = Matter.Runner, Bodies = Matter.Bodies, World = Matter.World, Composite = Matter.Composite; let engine = Engine.create(); .........完整代码请登录后点击上方下载按钮下载查看
网友评论0