html5 2048网页游戏代码

来源:https://www.sucaihuo.com/js/3836.html 2018-07-29 11:33浏览(952) 收藏

一款小清新界面风格html5 2048网页游戏代码,通过键盘wsad键和上下左右键来进行游戏,有4种游戏模式选择,3X3、4X4、5X5、6X6。
html5 2048网页游戏代码
分类:html5 > 设计 难易:中级
查看演示 下载资源 下载积分: 20 积分
关注公众号,免费赠送安装视频教程、环境和学习视频,后面会不断更新。

js代码

<script type="text/javascript" src="js/quietflow.min.js"></script>
<script type="text/javascript" src="js/frame.js"></script>
<script>
$(function() {
    // body... 
    function unScroll() {
    var top = $(document).scrollTop();
    $(document).on('scroll.unable',function (e) {
        $(document).scrollTop(top);
    })
    }
    unScroll();
    var random = Math.floor(Math.random() * (7 - 0 + 1) + 0);
    console.log(random);
    switch (random) {
        case 0:
            bouncingBalls();
            break;
        case 1:
            starfield();
            break;
        case 2:
            vortex();
            break;
        case 3:
            shootingLines();
            break;
        default:
            simpleGradient();
            break;
    }
    function bouncingBalls(argument) {
        $("body").quietflow({
            theme: "bouncingBalls",
            specificColors: [
                "rgba(255, 10, 50, .5)",
                "rgba(10, 255, 50, .5)",
                "rgba(10, 50, 255, .5)",
                "rgba(0, 0, 0, .5)"
            ]
        })
    }

    function simpleGradient(argument) {
        $("body").quietflow({
            theme: "simpleGradient",
            primary: "#B066FE",
            accent: "#63E2FF"
        })
    }

    function starfield() {
        $("body").quietflow({
            theme: "starfield"
        })
    }

    function vortex() {
        $("body").quietflow({
            theme: "vortex",
            miniRadii: 40
        })
    }

    function shootingLines() {
        $("body").quietflow({
            theme: "shootingLines",
            backgroundCol: "#141C26",
            lineColor: "#05E0E0",
            lineGlow: "#00ff00"
        })
    }
})
</script>
评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2