简体   繁体   English

单击时的 CSS / JS 动画

[英]CSS / JS animation on click

So I'm trying to build a simple online js game (I'm taking a course at the moment and wanted to have a little experiment).所以我正在尝试构建一个简单的在线 js 游戏(我目前正在学习一门课程并想进行一些实验)。 I downloaded the game duck hunt ( https://github.com/MattSurabian/DuckHunt-JS ) and expanded it from there.我下载了猎鸭游戏( https://github.com/MattSurabian/DuckHunt-JS )并从那里扩展了它。

I have added levels / adjust the game fine however I have added a character on the screen by using CSS and adding it into the html (switching the game from a first person view to more a third person perspective)我已经添加了关卡/调整了游戏,但是我通过使用 CSS 在屏幕上添加了一个角色并将其添加到 html 中(将游戏从第一人称视角切换到更多第三人称视角)

游戏画面

I would like to add an animation from when you click on the screen water will come from the statues mouth and hit the enimies... at the moment there is a flash when the user clicks however i wish to change this I'm not sure how this would be achieved?我想添加一个动画,当你点击屏幕时,水会从雕像的嘴里出来并击中敌人......目前用户点击时会出现闪光但是我想改变这个我不确定这将如何实现?

Any help would be grateful.任何帮助将不胜感激。

Flash Screen Code at the moment :目前闪屏代码:

//bind to gun events
        this.playfield.on('gun:out_of_ammo',_.bind(function(){this.outOfAmmo();},this));
        this.playfield.on('gun:fire',_.bind(function(){
            this.flashScreen();
        },this));

flashScreen : function(){
    $(".theFlash").css("display","block");
    setTimeout(function(){
        $('.theFlash').css("display","none");
    },70);
}

CSS: CSS:

.theFlash{
    background:#ffffff;
    width:900px;
    height:500px;
    position:relative;
    margin:0 auto;  
    z-index:10;
    display:none;
}

You should look up :hover for css http://www.w3schools.com/cssref/sel_hover.asp你应该查找:hover for css http://www.w3schools.com/cssref/sel_hover.asp

:hover {
    css declarations;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM