Tutorial on creating rock-paper-scissors effect in HTML5
I believe everyone has played the rock-paper-scissors game. Today I will bring you a code for the HTML5 rock-paper-scissors game based on angular.js. This game is a human-machine battle game. The user can choose one of the options: scissors, rock or paper, and the computer will randomly select an option to compete. The winner can add one point. Next, let’s take a look at the source code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="default"> <meta name="msapplication-tap-highlight" content="no"> <title>html5制作剪刀石头布效果</title> <meta name="keywords" content=" html5制作剪刀石头布效果" /> <meta name="description" content=" html5制作剪刀石头布效果" /> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css'> <link rel="stylesheet" type="text/css" href="css/normalize.css" /> <link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css"> <link rel="stylesheet" href="css/style.css"> </head> <body ng-app="app" ng-controller="ctrl"> <main style="background-image: {{b}}"> <article> <div ng-class="{'flip-me': answered}"> <div> <div> <div class="chip bg-light"> <span class="fa fa-hand-spock-o fa-fw ghost"></span> </div> </div> <div> <div class="chip bg-light"> <span class="fa fa-hand-{{splashIcon}}-o fa-fw"></span> </div> </div> </div> </div> <div class="answers row around" ng-class="{'ghost': spocked}"> <div class="column align-center"> <div ng-class="uiSetMoveClasses('rock', 1)" ng-click="uiPlay('rock')"> <span class="fa fa-hand-rock-o fa-fw fa-2x"></span> </div> </div> <div class="column align-center"> <div ng-class="uiSetMoveClasses('paper', 2)" ng-click="uiPlay('paper')"> <span class="fa fa-hand-paper-o fa-fw fa-2x"></span> </div> </div> <div class="column align-center"> <div ng-class="uiSetMoveClasses('scissors', 3)" ng-click="uiPlay('scissors')"> <span class="fa fa-hand-scissors-o fa-fw fa-2x"></span> </div> </div> </div> <footer class="row around"> <div> <span>Me</span> <h1>{{score.me}}</h1> </div> <div> <span>Spock</span> <h1>{{score.spock}}</h1> </div> </footer> </article> <div class="message-wrap content {{answered}}" ng-class="{'show': answered}"> <div class="message row align-center" ng-click="uiPlayAgain()" ng-class="{'bg-warning': spocked, 'bg-info': winner==='tie','bg-success': winner=='me','bg-alert': winner=='spock'}"> <div>{{message}}</div> <div class="chip beacon-1"> <span class="fa fa-3x fa-refresh"></span> </div> </div> </div> </main> <script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js'></script> <script src="js/main.js"></script> </body> </html>
I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!
Related reading:
Implementation steps of using JS to operate HTTP Cookies
About local Web-storage storage Detailed introduction
Write HTML first or CSS first when laying out a web page
The above is the detailed content of Tutorial on creating rock-paper-scissors effect in HTML5. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
