├── .gitignore ├── LICENSE.txt ├── README.md ├── css └── MemoryGame.css ├── images ├── card.svg ├── fruits │ ├── apple.jpg │ ├── fig.jpg │ ├── grape.jpg │ ├── kiwi.jpg │ ├── lemon.jpg │ ├── lime.jpg │ ├── mango.jpg │ ├── melon.jpg │ ├── orange.jpg │ ├── peach.jpg │ ├── pear.jpg │ ├── pinapple.jpg │ ├── plum.jpg │ ├── raspberry.jpg │ └── strawberry.jpg └── gear.png ├── index.html └── js ├── BrowserInterface.js ├── Card.js └── MemoryGame.js /.gitignore: -------------------------------------------------------------------------------- 1 | # IDEs 2 | .idea 3 | 4 | # OS files 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Maximo Mena 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fruit Matcher 2 | HTML5, CSS3 and Javascript memory game. 3 | 4 | Play this game on http://mmenavas.github.io/memory-game 5 | -------------------------------------------------------------------------------- /css/MemoryGame.css: -------------------------------------------------------------------------------- 1 | html { 2 | width:100%; 3 | height:100%; 4 | } 5 | body { 6 | margin:0; 7 | padding:0; 8 | width:100%; 9 | height:100%; 10 | } 11 | 12 | .modal { 13 | position: fixed; 14 | height: 90%; 15 | right: 0; 16 | top: 0; 17 | z-index: 3; 18 | width: 100%; 19 | visibility: hidden; 20 | opacity:0; 21 | -webkit-transition:opacity 0.4s linear; 22 | -moz-transition:opacity 0.4s linear; 23 | -ms-transition:opacity 0.4s linear; 24 | -o-transition:opacity 0.4s linear; 25 | transition:opacity 0.4s linear; 26 | } 27 | .modal.show { 28 | visibility: visible; 29 | opacity:1; 30 | } 31 | 32 | .valign-table { 33 | display: table; 34 | table-layout: fixed; 35 | } 36 | .valign-cell { 37 | display: table-cell; 38 | vertical-align: middle; 39 | } 40 | 41 | #memory--app-container { 42 | background-color: #0061a8; 43 | width:100%; 44 | height:90%; 45 | } 46 | 47 | .memory--menu-bar { 48 | width:100%; 49 | background-color: #222; 50 | height:10%; 51 | display:table; 52 | } 53 | 54 | .memory--menu-bar .inner { 55 | display:table-cell; 56 | vertical-align:middle; 57 | } 58 | .memory--menu-bar .left { 59 | text-align: left; 60 | float:left; 61 | width:50%; 62 | } 63 | .memory--menu-bar .right { 64 | text-align: right; 65 | float:right; 66 | width:50%; 67 | } 68 | .memory--app-name { 69 | color:#ccc; 70 | font-size:26px; 71 | margin:0; 72 | padding:1px 4px; 73 | text-transform: uppercase; 74 | font-family: "Courier New"; 75 | letter-spacing: 2px; 76 | } 77 | @media screen and (max-width: 480px) { 78 | .memory--app-name { 79 | font-size:16px; 80 | } 81 | } 82 | 83 | #memory--settings-icon { 84 | height: 24px; 85 | display: block; 86 | padding:4px 8px; 87 | float: right; 88 | } 89 | 90 | #memory--end-game-modal .wrapper { 91 | background-color: rgba(0, 0, 0, .86); 92 | text-align: center; 93 | color:#ccc; 94 | padding:8px 0; 95 | } 96 | #memory--end-game-modal h2, 97 | #memory--end-game-modal h3 { 98 | margin:0; 99 | margin-bottom: 4px; 100 | } 101 | 102 | #memory--settings-modal { 103 | background-color: rgba(0, 0, 0, .86); 104 | z-index: 4; 105 | } 106 | #memory--settings-modal form { 107 | min-width:240px; 108 | width:50%; 109 | margin:0 auto; 110 | text-align: center; 111 | color:#ccc; 112 | } 113 | 114 | .memory--settings-label { 115 | margin:8px 0; 116 | } 117 | 118 | #memory--settings-grid, 119 | #memory--settings-reset { 120 | width:100%; 121 | margin-bottom:16px; 122 | font-size:18px; 123 | background:transparent; 124 | color:#ccc; 125 | height:50px; 126 | text-align: center; 127 | } 128 | 129 | #memory--settings-grid option { 130 | padding-top:5px; 131 | padding-bottom:5px; 132 | } 133 | 134 | #memory--settings-reset { 135 | border-radius:5px; 136 | border:2px solid #ccc; 137 | cursor: pointer; 138 | } 139 | 140 | #memory--cards { 141 | margin:0 auto; 142 | padding:0; 143 | height:100%; 144 | list-style-type: none; 145 | list-style-image: none; 146 | position:relative; 147 | } 148 | /* entire container, keeps perspective */ 149 | .flip-container { 150 | -webkit-perspective: 1000px; 151 | perspective: 1000px; 152 | float:left; 153 | } 154 | 155 | /* flip the pane when clicked */ 156 | .flip-container.clicked .front { 157 | -webkit-transform: rotateY(180deg); 158 | -moz-transform: rotateY(180deg); 159 | -ms-transform: rotateY(180deg); 160 | -o-transform: rotateY(180deg); 161 | transform: rotateY(180deg); 162 | } 163 | .flip-container.clicked .back { 164 | -webkit-transform: rotateY(0deg); 165 | -moz-transform: rotateY(0deg); 166 | -ms-transform: rotateY(0deg); 167 | -o-transform: rotateY(0deg); 168 | transform: rotateY(0deg); 169 | } 170 | 171 | /* flip speed goes here */ 172 | .flipper { 173 | width:90%; 174 | height:90%; 175 | margin:0% auto; 176 | -webkit-transition: 0.5s; 177 | -moz-transition: 0.5s; 178 | -ms-transition: 0.5s; 179 | -o-transition: 0.5s; 180 | transition: 0.5s; 181 | -webkit-transform-style: preserve-3d; 182 | -moz-transform-style: preserve-3d; 183 | transform-style: preserve-3d; 184 | position: relative; 185 | top:5%; 186 | bottom:5%; 187 | } 188 | 189 | /* hide back of pane during swap */ 190 | .front, .back { 191 | width:100%; 192 | height:100%; 193 | display: block; 194 | -webkit-backface-visibility: hidden; 195 | -moz-backface-visibility: hidden; 196 | backface-visibility: hidden; 197 | -webkit-transition: 0.5s; 198 | -moz-transition: 0.5s; 199 | -ms-transition: 0.5s; 200 | -o-transition: 0.5s; 201 | transition: 0.5s; 202 | -webkit-transform-style: preserve-3d; 203 | -moz-transform-style: preserve-3d; 204 | transform-style: preserve-3d; 205 | position: absolute; 206 | top: 0; 207 | left: 0; 208 | } 209 | 210 | /* front pane, placed above back */ 211 | .front { 212 | /* for firefox 31 */ 213 | -webkit-transform: rotateY(0deg); 214 | -moz-transform: rotateY(0deg); 215 | -ms-transform: rotateY(0deg); 216 | -o-transform: rotateY(0deg); 217 | transform: rotateY(0deg); 218 | background-color: #e12d00; 219 | border-radius: 5%; 220 | background-image: url(../images/card.svg); 221 | background-position:50% 50%; 222 | background-repeat: no-repeat; 223 | background-size: contain; 224 | 225 | } 226 | 227 | /* back, initially hidden pane */ 228 | .back { 229 | -webkit-transform: rotateY(-180deg); 230 | -moz-transform: rotateY(-180deg); 231 | -ms-transform: rotateY(-180deg); 232 | -o-transform: rotateY(-180deg); 233 | transform: rotateY(-180deg); 234 | background-color: #fff; 235 | border-radius: 5%; 236 | background-position:50% 50%; 237 | background-repeat: no-repeat; 238 | background-size: cover; 239 | } 240 | 241 | .back.card-1 { 242 | background-image: url(../images/fruits/apple.jpg); 243 | } 244 | .back.card-2 { 245 | background-image: url(../images/fruits/fig.jpg); 246 | } 247 | .back.card-3 { 248 | background-image: url(../images/fruits/grape.jpg); 249 | } 250 | .back.card-4 { 251 | background-image: url(../images/fruits/kiwi.jpg); 252 | } 253 | .back.card-5 { 254 | background-image: url(../images/fruits/lemon.jpg); 255 | } 256 | .back.card-6 { 257 | background-image: url(../images/fruits/lime.jpg); 258 | } 259 | .back.card-7 { 260 | background-image: url(../images/fruits/mango.jpg); 261 | } 262 | .back.card-8 { 263 | background-image: url(../images/fruits/melon.jpg); 264 | } 265 | .back.card-9 { 266 | background-image: url(../images/fruits/orange.jpg); 267 | } 268 | .back.card-10 { 269 | background-image: url(../images/fruits/peach.jpg); 270 | } 271 | .back.card-11 { 272 | background-image: url(../images/fruits/pear.jpg); 273 | } 274 | .back.card-12 { 275 | background-image: url(../images/fruits/pinapple.jpg); 276 | } 277 | .back.card-13 { 278 | background-image: url(../images/fruits/plum.jpg); 279 | } 280 | .back.card-14 { 281 | background-image: url(../images/fruits/raspberry.jpg); 282 | } 283 | .back.card-15 { 284 | background-image: url(../images/fruits/strawberry.jpg); 285 | } 286 | 287 | /** Matching Cards **/ 288 | /** 289 | * If you wish to have custom matching images, you can do so 290 | * by leveraging the 'matching' class which is added to one 291 | * of the matching cards. See the example below. 292 | * 293 | * .back.card-1 { 294 | * background-image: url(../images/fruits/apple_1.jpg); 295 | * } 296 | * 297 | * .back.matching.card-1 { 298 | * background-image: url(../images/fruits/apple_2.jpg); 299 | * } 300 | * 301 | */ 302 | -------------------------------------------------------------------------------- /images/card.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | -------------------------------------------------------------------------------- /images/fruits/apple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/apple.jpg -------------------------------------------------------------------------------- /images/fruits/fig.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/fig.jpg -------------------------------------------------------------------------------- /images/fruits/grape.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/grape.jpg -------------------------------------------------------------------------------- /images/fruits/kiwi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/kiwi.jpg -------------------------------------------------------------------------------- /images/fruits/lemon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/lemon.jpg -------------------------------------------------------------------------------- /images/fruits/lime.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/lime.jpg -------------------------------------------------------------------------------- /images/fruits/mango.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/mango.jpg -------------------------------------------------------------------------------- /images/fruits/melon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/melon.jpg -------------------------------------------------------------------------------- /images/fruits/orange.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/orange.jpg -------------------------------------------------------------------------------- /images/fruits/peach.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/peach.jpg -------------------------------------------------------------------------------- /images/fruits/pear.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/pear.jpg -------------------------------------------------------------------------------- /images/fruits/pinapple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/pinapple.jpg -------------------------------------------------------------------------------- /images/fruits/plum.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/plum.jpg -------------------------------------------------------------------------------- /images/fruits/raspberry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/raspberry.jpg -------------------------------------------------------------------------------- /images/fruits/strawberry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/fruits/strawberry.jpg -------------------------------------------------------------------------------- /images/gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmenavas/memory-game/7da33da0286588f5a4770a8f6ddab7ea20f28090/images/gear.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |