Skip to content

Commit

Permalink
Added fading shot on target screen
Browse files Browse the repository at this point in the history
  • Loading branch information
dbecker1 committed Jul 5, 2020
1 parent 6862783 commit 8baaa27
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 70 deletions.
136 changes: 67 additions & 69 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Take Aim</title>

<style>
@keyframes fadeShot {
from {opacity: 1;}
to {opacity: 0; visibility: hidden}
}
</style>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
5 changes: 5 additions & 0 deletions src/components/TargetCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class TargetCanvas extends React.Component{
{this.props.shots.map((value, index) => {
if (shotMode === "standard") {
return <circle cx={value.center.x} cy={value.center.y} r={3} style={{fill: "red"}} />
} else if (shotMode === "fade") {
return <circle cx={value.center.x}
cy={value.center.y}
r={5}
style={{fill: "black", animationName: "fadeShot", animationDuration: "3s", animationFillMode: "forwards"}} />
}
return null;
})}
Expand Down
2 changes: 1 addition & 1 deletion src/components/targetScreen/ProjectorScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ProjectorScreen extends React.Component {
</Row>
<Row>
<Col sm={12} className={"text-center"}>
<TargetCanvas shotMode={"standard"}/>
<TargetCanvas shotMode={"fade"}/>
</Col>
</Row>
</>
Expand Down

0 comments on commit 8baaa27

Please sign in to comment.