diff --git a/Catch Me Card Edition/index.html b/Catch Me Card Edition/index.html new file mode 100644 index 00000000..848c4cd4 --- /dev/null +++ b/Catch Me Card Edition/index.html @@ -0,0 +1,14 @@ + + + + Catch Me + + + + +
+

Catch Me

+
+ + + \ No newline at end of file diff --git a/Catch Me Card Edition/readme.md b/Catch Me Card Edition/readme.md new file mode 100644 index 00000000..4183b510 --- /dev/null +++ b/Catch Me Card Edition/readme.md @@ -0,0 +1,7 @@ +## Catch me if you can + + +### Using HTML, CSS & JS +##### you can find screenshot in this folder + +## Screeen shot: https://github.com/ammy20019/javascript-mini-projects/blob/master/CatchMeIfYouCan/ammy20019/screenshot.PNG diff --git a/Catch Me Card Edition/screenshot.PNG b/Catch Me Card Edition/screenshot.PNG new file mode 100644 index 00000000..1a678fda Binary files /dev/null and b/Catch Me Card Edition/screenshot.PNG differ diff --git a/Catch Me Card Edition/script.js b/Catch Me Card Edition/script.js new file mode 100644 index 00000000..46fd8676 --- /dev/null +++ b/Catch Me Card Edition/script.js @@ -0,0 +1,41 @@ +var box = document.getElementById("box"); + +var viewWidth = window.innerWidth; +var viewHeight = window.innerHeight; + + +// Updates the viewport height and width dynamically +window.addEventListener("resize", function(event) { + viewWidth = window.innerWidth; + viewHeight = window.innerHeight; +}); + + + +box.addEventListener("mouseover", function(event) { + var boxAttr = box.getBoundingClientRect(); + + var pos = getNewPosition(boxAttr.width, boxAttr.height); + + box.style.top = pos.y + "px"; + box.style.left = pos.x + "px"; +}); + + + +function getNewPosition(boxWidth, boxHeight) { + + // The boxWidth and boxHeight are subtracted so that they would not move out from the right and bottom direction + var newX = Math.floor((Math.random() * viewWidth) + 1 - boxWidth); + var newY = Math.floor((Math.random() * viewHeight) + 1 - boxHeight); + + // These will satisfy that box does not move go out in the top and left direction + if(newX < 0) { + newX = 0; + } + if(newY < 0) { + newY = 0; + } + + return {x: newX, y: newY}; +} \ No newline at end of file diff --git a/Catch Me Card Edition/style.css b/Catch Me Card Edition/style.css new file mode 100644 index 00000000..b46e40b3 --- /dev/null +++ b/Catch Me Card Edition/style.css @@ -0,0 +1,15 @@ +#box { + width: 10vw; + height: 10vw; + background-color: #b916f4; + cursor: pointer; + position: absolute; + display: flex; + justify-content: center; + align-items: center; +} + +#box p { + font-size: 1.7vw; + color: white; +} \ No newline at end of file diff --git a/README.md b/README.md index ff06b8ec..aa498b26 100644 --- a/README.md +++ b/README.md @@ -544,6 +544,8 @@ More information about the pack can be found here [Github Student Developer Pack | | | | | |------|------|------|------| +| [3D Portfolio](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/3D-Portfolio) | [3D](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/3D) | [Blog Website ](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/Blog-Website) | [Bloggers Website ](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/Blogger-Website-main/blogers%20%20website) | +| [Bootstrap Portfolio](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/Bootstrap%20Portfolio) | [Calculator](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/calculator) | [Catch Me Card Game](https://github.com/Tanmay-Giram/Ultimate-Web-Development-Resources/tree/adding-Catch-Me-Card-Game/Catch%20Me%20Card%20Edition) | | [Chess](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/Chess) | [City Finder](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/City%20Finder) | | [3D Portfolio](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/3D-Portfolio) | [3D](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/3D) | [ ASCII VALUE GENERATOR ](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/ascii-value-generator) | [Blog Website ](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/Blog-Website) | [Bloggers Website ](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/Blogger-Website-main/blogers%20%20website) | | [Bootstrap Portfolio](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/Bootstrap%20Portfolio) | [Calculator](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/calculator) | [Chess](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/Chess) | [City Finder](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/City%20Finder) | | [Clock Project](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/ClockProject) | [Disney Character Game](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/disney-character-game) | [Drum Kit](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/DRUM-KIT) | [Dice Challenge](https://github.com/DhanushNehru/Ultimate-Web-Development-Resources/tree/main/Dice-Challenge) |