-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added dynamics page and react router (#115)
* Added dynamics page and react router * Added sensorboxes and pictures * Rotate image according to gyroscope * Made animation smoother * Fixed the import for dynamics and added inbuilt PI value * Removed unused import * Removed unused import * Removed unused import
- Loading branch information
1 parent
72ad551
commit 7133018
Showing
9 changed files
with
124 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.dynamics { | ||
display: flex; | ||
} | ||
|
||
.dynamics-sensorbox { | ||
width: 40%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-evenly; | ||
align-items: center; | ||
} | ||
|
||
.dynamics-pictures { | ||
width: 60%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-around; | ||
align-items: center; | ||
} | ||
|
||
.pod-picture-container { | ||
background-color: rgb(209, 209, 209); | ||
width: 60%; | ||
height: 40%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
border-radius: 40px; | ||
overflow: hidden; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import SensorBox from "@/components/SensorBoxes/Sensors/SensorBox"; | ||
import PodContext from "@/services/PodContext"; | ||
import FrontPod from "@/data/images/FrontPod.png"; | ||
import SidePod from "@/data/images/SidePod.png"; | ||
import "./Dynamics.css"; | ||
import { useContext } from "react"; | ||
|
||
function Dynamics() { | ||
const { podData } = useContext(PodContext); | ||
const { gyroscope } = podData; | ||
return ( | ||
<div className="dynamics"> | ||
<div className="dynamics-sensorbox"> | ||
<SensorBox title="Roll" value={Math.round(gyroscope.roll * 100) / 100} /> | ||
<SensorBox title="Pitch" value={Math.round(gyroscope.pitch * 100) / 100} /> | ||
</div> | ||
<div className="dynamics-pictures"> | ||
<div className="pod-picture-container"> | ||
<img | ||
src={FrontPod} | ||
alt="front view of the pod" | ||
style={{ | ||
transform: `rotate(${Math.round(gyroscope.roll * 100) / 100}deg)`, | ||
}} | ||
/> | ||
</div> | ||
<div className="pod-picture-container"> | ||
<img | ||
src={SidePod} | ||
alt="side view of the pod" | ||
style={{ | ||
transform: `rotate(${Math.round(gyroscope.pitch * 100) / 100}deg)`, | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Dynamics; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { default as Dashboard } from "./Dashboard/Dashboard"; | ||
export { default as Dynamics } from "./Dynamics/Dynamics"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters