-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from Benjythebee/add/emotionManager
add emotionManager
- Loading branch information
Showing
8 changed files
with
508 additions
and
10 deletions.
There are no files selected for viewing
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,77 @@ | ||
import React, { useEffect } from "react" | ||
import styles from "./Emotions.module.css" | ||
import MenuTitle from "./MenuTitle" | ||
import { SceneContext } from "../context/SceneContext"; | ||
import Slider from "./Slider"; | ||
|
||
// import 'react-dropdown/style.css'; | ||
|
||
export default function Emotions(){ | ||
|
||
const { characterManager,moveCamera } = React.useContext(SceneContext) | ||
|
||
const [isConstant, setConstant] = React.useState(false) | ||
const [intensity, setIntensity] = React.useState(1) | ||
|
||
const availableEmotions = characterManager.emotionManager.availableEmotions | ||
|
||
useEffect(() => { | ||
moveCamera({ targetY:1.8, distance:2}) | ||
}, []) | ||
|
||
const playEmotion = (emotion)=>{ | ||
characterManager.emotionManager.playEmotion(emotion,undefined,isConstant,intensity) | ||
} | ||
|
||
return ( | ||
|
||
<div> | ||
<div className={styles["InformationContainerPos"]}> | ||
<MenuTitle title="Emotions" width={180} right={20}/> | ||
<div className={styles["scrollContainer"]}> | ||
<div className={styles["traitInfoText"]}> | ||
View different emotions | ||
</div> | ||
|
||
<div className={styles["checkboxHolder"]}> | ||
<div> | ||
</div> | ||
|
||
<label className={styles["custom-checkbox"]}> | ||
<input | ||
type="checkbox" | ||
checked={isConstant} | ||
onChange={() => setConstant(!isConstant)} | ||
/> | ||
<div className={styles["checkbox-container"]}></div> | ||
</label> | ||
<div/><div/> | ||
<div style={{color:"white"}}>Constant Emotion</div> | ||
|
||
|
||
</div> | ||
<br /> | ||
<div className={styles["traitInfoText"]}> | ||
Intensity: {parseFloat(intensity.toFixed(2))} | ||
</div> | ||
|
||
<Slider title='' value = {parseFloat(intensity.toFixed(2))} onChange={(e) => setIntensity(parseFloat(e.currentTarget.value.toString()))} min={0} max={1} step={0.01}/> | ||
<br/> | ||
|
||
{availableEmotions.map((emotion, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
className={styles["actionButton"]} | ||
onClick={() => { | ||
playEmotion(emotion) | ||
}}> | ||
<div> {emotion} </div> | ||
</div> | ||
) | ||
})} | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
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,110 @@ | ||
|
||
.InformationContainerPos { | ||
position: fixed; | ||
right: 132px; | ||
top: 98px; | ||
width:250px; | ||
height: -webkit-calc(100vh - 176px); | ||
height: calc(100vh - 176px); | ||
backdrop-filter: blur(22.5px); | ||
background: rgba(5, 11, 14, 0.8); | ||
z-index: 1000; | ||
user-select: none; | ||
} | ||
|
||
.scrollContainer { | ||
height: 100%; | ||
width: 80%; | ||
overflow-y: scroll; | ||
position: relative; | ||
overflow-x: hidden !important; | ||
margin: 30px; | ||
height: -webkit-calc(100% - 40px); | ||
height: calc(100% - 40px); | ||
} | ||
.centerAlign{ | ||
text-align: center; | ||
} | ||
.traitInfoTitle { | ||
text-align: center; | ||
color: white; | ||
text-transform: uppercase; | ||
text-shadow: 1px 1px 2px black; | ||
font-size: 14px; | ||
word-spacing: 2px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
|
||
.traitInfoText { | ||
color: rgb(179, 179, 179); | ||
/* text-transform: uppercase; */ | ||
text-shadow: 1px 1px 2px black; | ||
font-size: 14px; | ||
word-spacing: 2px; | ||
margin-bottom: 6px; | ||
display: flex; | ||
justify-content: left; | ||
} | ||
|
||
/* Hide the default checkbox */ | ||
.custom-checkbox input[type="checkbox"] { | ||
display: none; | ||
} | ||
|
||
/* Style the custom checkbox */ | ||
.custom-checkbox .checkbox-container { | ||
display: inline-block; | ||
width: 20px; | ||
height: 20px; | ||
border: 2px solid #284b39; /* Change border color as needed */ | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} | ||
|
||
.custom-checkbox .checkbox-container.checked { | ||
background-color: #5eb086; /* Change background color when checked */ | ||
} | ||
|
||
.custom-checkbox .checkbox-container .checkmark { | ||
display: none; | ||
} | ||
|
||
/* Style the checkmark when the checkbox is checked */ | ||
.custom-checkbox input[type="checkbox"]:checked + .checkbox-container { | ||
background-color: #5eb086; /* Change background color when checked */ | ||
} | ||
|
||
.custom-checkbox input[type="checkbox"]:checked + .checkbox-container .checkmark { | ||
display: block; | ||
} | ||
|
||
.checkboxHolder { | ||
display: flex; | ||
gap: 5px; | ||
align-items: center; | ||
justify-content: left; | ||
height: 40px; | ||
} | ||
|
||
|
||
|
||
.actionButton{ | ||
margin: 10px auto; | ||
text-align: center; | ||
outline-color: #3b434f; | ||
color: #d1d7df; | ||
outline-width: 2px; | ||
outline-style: solid; | ||
background-color: #1e2530; | ||
height: 30px; | ||
width: 80%; | ||
font-family: "TTSC-Bold"; | ||
text-transform: uppercase !important; | ||
font-size:x-small; | ||
display: flex; | ||
justify-content: center; | ||
align-items : center; | ||
user-select: none; | ||
cursor: pointer; | ||
} |
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
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.
Oops, something went wrong.