jQuery抛洒金币效果

jQuery抛洒金币效果

抛洒金币的效果主要是由jQuery的animate动画效果完成,也就是改变金币的运动轨迹,定时去执行,直到洒落到地面。

淘建站为您提供更多_其它特效_抽奖_抽奖_金币,在此特别感谢您对我们的支持与厚爱!

查看演示

演示不了,点击反馈

加入收藏

下载 126 次

打赏作者

觉得不错,可打赏下作者

下载资源

免费共享

特别说明:本站资源来自网友发布分享,仅供学习与参考,请勿用于商业用途,若有侵权请联系删除(272966172@qq.com)。
分类:其它特效 > 抽奖 难易程度:初级

口袋和金币

<div class="kodai">
    <img src="images/kd2.png" class="full" />
    <img src="images/kd1.png" class="empty" />
</div>

点击口袋,抛洒金币效果

$('.item1 div.kodai').on('click', function() {

    if (clicked === false) {
        $('.full').css({
            'display': 'none'
        });
        $('.empty').css({
            'display': 'block'
        });
        clicked = true;

        $('.item1 .clipped-box').css({
            'display': 'block'
        });
        // Apply to each clipped-box div.
        $('.clipped-box img').each(function() {
            var v = rand(120, 90),
                    angle = rand(80, 89),
                    theta = (angle * Math.PI) / 180,
                    g = -9.8;

            // $(this) as self
            var self = $(this);
            var t = 0,
                    z, r, nx, ny,
                    totalt = 10;
            var negate = [1, -1, 0],
                    direction = negate[Math.floor(Math.random() * negate.length)];

            var randDeg = rand(-5, 10),
                    randScale = rand(0.9, 1.1),
                    randDeg2 = rand(30, 5);

            // And apply those
            $(this).css({
                'transform': 'scale(' + randScale + ') skew(' + randDeg + 'deg) rotateZ(' + randDeg2 + 'deg)'
            });

            // Set an interval
            z = setInterval(function() {
                var ux = (Math.cos(theta) * v) * direction;
                var uy = (Math.sin(theta) * v) - ((-g) * t);
                nx = (ux * t);
                ny = (uy * t) + (0.25 * (g) * Math.pow(t, 2));
                if (ny < -40) {
                    ny = -40;
                }
                //$("#html").html("g:" + g + "bottom:" + ny + "left:" + nx + "direction:" + direction);
                $(self).css({
                    'bottom': (ny) + 'px',
                    'left': (nx) + 'px'
                });
                // Increase the time by 0.10
                t = t + 0.10;

                //跳出循环
                if (t > totalt) {
                    clicked = false;
                    first = true;
                    clearInterval(z);
                }
            }, 20);
        });
    }
});

声明:本资料由淘建站会员提供,如转载注明来源,资料来源淘建站免费素材库:https://www.taojz.cn/texiao/577.html
jQuery抛洒金币效果 希望对你有帮助,感谢您的支持!
  • jQuery数字上下翻滚抽奖机代码

    jQuery数字上下翻滚抽奖机代码

  • JQuery 电话姓名抽奖 2.0

    JQuery 电话姓名抽奖 2.0

  • 抽奖转盘

    抽奖转盘

  • 抽奖大转盘

    抽奖大转盘

  • 原生js随机文字抽奖代码

    原生js随机文字抽奖代码

  • jquery圆盘抽奖特效

    jquery圆盘抽奖特效

  • jquery css3点击红包摇一摇抽奖代码

    jquery css3点击红包摇一摇抽奖代码

  • jquery兄弟连学员点名系统_类似抽奖的学员点名工具

    jquery兄弟连学员点名系统_类似抽奖的学员点名工具

  • jquery鼠标点击抽奖按钮奖品格子闪烁摇奖随机抽奖

    jquery鼠标点击抽奖按钮奖品格子闪烁摇奖随机抽奖

  • html5 canvas圆形转盘抽奖代码

    html5 canvas圆形转盘抽奖代码

  • jQuery+Flash两种不同的砸金蛋源码

    jQuery+Flash两种不同的砸金蛋源码

  • jQuery幸运水果机

    jQuery幸运水果机

  • 留言(0)
    头像
     阿里云限量代金券,戳我领取
    1 2