Skip to content

This PR is the solution to the 'Terrarium' #2 #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions 2-terrarium/TERRARIUM/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
Binary file added 2-terrarium/TERRARIUM/images/plant1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/plant9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2-terrarium/TERRARIUM/images/screenshot_gray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions 2-terrarium/TERRARIUM/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Welcome to my Virtual Terrarium</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="./style.css">
</head>
<body>
<h1 style="color: red">My Terrarium</h1>
<div id="page">
<button id="ex" >EXCHANGE</button>
<div id="left-container" class="container">
<div class="plant-holder">
<img class="plant" alt="plant" id="plant1" src="./images/plant1.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant2" src="./images/plant2.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant3" src="./images/plant3.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant4" src="./images/plant4.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant5" src="./images/plant5.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant6" src="./images/plant6.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant7" src="./images/plant7.png" />
</div>
</div>
<div id="right-container" class="container">
<div class="plant-holder">
<img class="plant" alt="plant" id="plant8" src="./images/plant8.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant9" src="./images/plant9.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant10" src="./images/plant10.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant11" src="./images/plant11.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant12" src="./images/plant12.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant13" src="./images/plant13.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant14" src="./images/plant14.png" />
</div>

</div>

<div id="terrarium">
<div class="jar-top"></div>
<div class="jar-walls">
<div class="jar-glossy-long"></div>
<div class="jar-glossy-short"></div>

</div>
<div class="dirt"></div>
<div class="jar-bottom"></div>
</div>
</div>
<script src="./script.js" defer></script>
</body>
</html>
64 changes: 64 additions & 0 deletions 2-terrarium/TERRARIUM/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
function dragElement(terrariumElement) {
document.getElementById('ex').addEventListener("click", exchange)
//set 4 positions for positioning on the screen
let pos1 = 0,
pos2 = 0,
pos3 = 0,
pos4 = 0;
terrariumElement.onpointerdown = pointerDrag;
function pointerDrag(e) {
e.preventDefault();
console.log(e);
pos3 = e.clientX;
pos4 = e.clientY;
document.onpointermove = elementDrag;
document.onpointerup = stopElementDrag;
}
function elementDrag(e) {
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
console.log(pos1, pos2, pos3, pos4);
terrariumElement.style.top = (terrariumElement.offsetTop - pos2) + 'px';
terrariumElement.style.left = (terrariumElement.offsetLeft - pos1) + 'px';
}
function stopElementDrag() {
document.onpointerup = null;
document.onpointermove = null;
}
let n=1
function exchange() {
switch(n){
case 1:
document.getElementById("left-container").style.left="84%";
document.getElementById("right-container").style.right="84%";
n=2;
break;
case 2:
document.getElementById("left-container").style.left="0%";
document.getElementById("right-container").style.right="0%";
n=1
break;


}

}
}


dragElement(document.getElementById('plant1'));
dragElement(document.getElementById('plant2'));
dragElement(document.getElementById('plant3'));
dragElement(document.getElementById('plant4'));
dragElement(document.getElementById('plant5'));
dragElement(document.getElementById('plant6'));
dragElement(document.getElementById('plant7'));
dragElement(document.getElementById('plant8'));
dragElement(document.getElementById('plant9'));
dragElement(document.getElementById('plant10'));
dragElement(document.getElementById('plant11'));
dragElement(document.getElementById('plant12'));
dragElement(document.getElementById('plant13'));
dragElement(document.getElementById('plant14'));
113 changes: 113 additions & 0 deletions 2-terrarium/TERRARIUM/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
h1 {
color: #3a241d;
text-align: center;
}

body {
font-family: helvetica, arial, sans-serif;
}
#ex{
background-color: rgb(239, 114, 114);
height: 5%;
width: 20%;
position: absolute;
left: 40%;
}
#left-container {
background-color: #eee;
width: 15%;
left: 0px;
top: 0px;
position:absolute;
height: 100%;
padding: 10px;
}

#right-container {
background-color: #eee;
width: 15%;
right: 0px;
top: 0px;
position: absolute;
height: 100%;
padding: 10px;
}
.plant-holder {

display:flex;
justify-content: center;
height: 13%;

}

.plant {
position: absolute;
max-width: 150%;
max-height: 150%;
justify-content: space-around;
z-index: 2;
}
.jar-walls {
height: 80%;
width: 60%;
background: #d1e1df;
border-radius: 1rem;
position: absolute;
bottom: 0.5%;
left: 20%;
opacity: 0.5;
z-index: 1;
}

.jar-top {
width: 50%;
height: 5%;
background: #d1e1df;
position: absolute;
bottom: 80.5%;
left: 25%;
opacity: 0.7;
z-index: 1;
}

.jar-bottom {
width: 50%;
height: 1%;
background: #d1e1df;
position: absolute;
bottom: 0%;
left: 25%;
opacity: 0.7;
}
.jar-glossy-long{
height: 22%;
width: 2.5%;
background: #d4fffb;
border-radius: 2rem;
position: absolute;
bottom:13%;
left: 7%;
z-index: 2;
}

.jar-glossy-short{
height: 5.5%;
width: 2.5%;
background: #d4fffb;
border-radius: 2rem;
position: absolute;
bottom: 37%;
left: 7%;
z-index: 2;
}
.dirt {
width: 60%;
height: 5%;
background: #3a241d;
position: absolute;
border-radius: 0 0 1rem 1rem;
bottom: 1%;
left: 20%;
opacity: 0.7;
z-index: -1;
}
33 changes: 33 additions & 0 deletions 2-terrarium/mock_up(subtask-1 assignment)/hi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HackerRank</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<b><h3 id="h">HackerRank</h3></b>
<div id="page">
<div id="dash"></div>
<div id="head">
<h5 id="prep">prepare</h5>
<h5 id="cert">certify</h5>
<h5 id="comp">complete</h5>
<h5 id="app">apply</h5>
</div>
<div class ="bar">
<div id="bar">
<h3 id="l">Prepare</h3></b>
<h4 id="lp">Learn Programming Skills</h4>
</div>
</div>
<div class="lan">
<h id="a">Problem Solving</h>
<h id="b">Problem Solving</h>
<div id="pyt"></div>
<div id="ps"></div>
</div>
</div>
</body>
</html>
92 changes: 92 additions & 0 deletions 2-terrarium/mock_up(subtask-1 assignment)/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
body{
background-color: rgb(10, 26, 42);
}

#l{
font-size: 100%;
color: rgb(134, 134, 134);
position:absolute;
top:5%;
}
#lp{
font-size: 100%;
color: rgb(140, 138, 138);
position:absolute;
top: 7%;
}

#h{

font-size: 150%;
color: rgb(255, 255, 255);
position: absolute;
top:-1px;
left: 0%;
opacity: 1 ;
z-index: 2;
}
#prep{
font-size: 75%;
color: rgb(255, 255, 255);
position: absolute;
top: 1%;;
left: 20%;
}
#cert{
font-size: 75%;
color: rgb(255, 255, 255);
position: absolute;
top: 1%;;
left: 30%;
}
#comp{
font-size: 75%;
color: rgb(255, 255, 255);
position: absolute;
top: 1%;;
left: 40%;
}
#app{
font-size: 75%;
color: rgb(255, 255, 255);
position: absolute;
top: 1%;;
left: 50%;
}
#pyt{
height:15%;
width:25%;
background-color:white;
position: absolute;
top:15%;
border-radius: 12%;
opacity: 0.1;
z-index: 3;
}
#ps{

height:15%;
width:25%;
background-color:white;
position: absolute;
top:15%;
left:30%;
border-radius: 12%;
opacity: 0.1;
z-index: 3;
}
#a{
color: white;
position:absolute;
left:35%;
top:21%;
opacity: 0.5;
}
#b{
color: white;
position:absolute;
left:7%;
top:21%;
opacity: 0.5;

}
Loading