js实现液体流动效果

代码语言:html

所属分类:动画

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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>  Fluid Simulation</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            overflow: hidden;
        }

        body {
            background: #333;
        }

        #reset {
            position: absolute;
            left: 50%;
            top: 10px;
            margin-left: -400px;
            background: #444;
            border: 1px solid #555;
            color: #888;
            padding: 6px 10px;
            cursor: pointer;
            opacity: 0.8;
        }

        #c {
            width: 800px;
            height: 376px;
            margin: 0 auto;
            display: block;
        }

        #info {
            position: absolute;
            left: -1px;
            top: -1px;
            width: auto;
            max-width: 380px;
            height: auto;
            background: #f2f2f2;
            border-bottom-right-radius: 10px;
        }

        #top {
            background: #fff;
            width: 100%;
            height: auto;
            position: relative;
            border-bottom: 1px solid #eee;
        }

        p {
            font-family: Arial, sans-serif;
            color: #666;
            text-align: justify;
            font-size: 16px;
            margin: 10px;
        }

        a {
            font-family: sans-serif;
            color: #444;
            text-decoration: none;
            font-size: 20px;
        }

        #site {
            float: left;
            margin: 10px;
            color: #38a;
        }

        #close {
            float: right;
            margin: 10px;
        }
    </style>

</head>
<body translate="no">
    <canvas id="c"> </canvas>
    <button id="reset">new colours</button>
    <div id="info"  style="display:none;">
        <div id="top">
            <a id="close" href="">close</a>
        </div>
        <p>
            <br>
            - Alter particles/groups with the GROUPS variable.<br><br>
            - Customize colours with GROUP_COLOURS.<br><br>
            - Use the mouse to move the fluid.<br><br>
            - Click anywhere to make water.<br.........完整代码请登录后点击上方下载按钮下载查看

网友评论0