-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: animations by audio recording status
- Loading branch information
Showing
8 changed files
with
116 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
Empty file.
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,20 @@ | ||
const sprite = document.querySelector(".sprite"); | ||
|
||
function triggerWake() { | ||
sprite.classList.remove("record", "waiting"); | ||
sprite.classList.add("wake"); | ||
} | ||
|
||
function triggerRecord() { | ||
sprite.classList.remove("wake", "waiting"); | ||
sprite.classList.add("record"); | ||
} | ||
|
||
function triggerWaiting() { | ||
sprite.classList.remove("wake", "record"); | ||
sprite.classList.add("waiting"); | ||
} | ||
|
||
function triggerDone() { | ||
sprite.classList.remove("wake", "record", "waiting"); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* Base styles for the split sprite */ | ||
.sprite { | ||
width: 40px; /* sprite width adjusted to 40px */ | ||
height: 40px; /* sprite height adjusted to 40px */ | ||
border-radius: 50%; | ||
background-image: linear-gradient(to right, #000 50%, #fff 50%); | ||
box-shadow: 0 0 0 2px #000; /* Adjusted border thickness for smaller size */ | ||
transition: transform 0.3s ease, opacity 0.3s ease; | ||
opacity: 0; /* sprite is invisible by default */ | ||
position: relative; /* Required for absolute positioning of pseudo-elements */ | ||
display: flex; /* Center content */ | ||
justify-content: center; | ||
align-items: center; | ||
margin: 20px; | ||
} | ||
|
||
/* Pulse animation while recording */ | ||
@keyframes pulse { | ||
0%, | ||
100% { | ||
transform: scale(1); | ||
} | ||
50% { | ||
transform: scale(1.1); | ||
} | ||
} | ||
|
||
.sprite.record { | ||
animation: pulse 1s infinite ease-in-out; | ||
opacity: 1; /* sprite is visible while recording */ | ||
} | ||
|
||
/* Spin animation while waiting for a response */ | ||
@keyframes spin { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
.sprite.waiting { | ||
animation: spin 2s infinite linear; | ||
opacity: 1; /* sprite is visible while waiting */ | ||
} | ||
|
||
/* Appear animation for wake word activation */ | ||
@keyframes appear { | ||
0% { | ||
opacity: 0; | ||
} | ||
100% { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
.sprite.wake { | ||
animation: appear 1s forwards; | ||
opacity: 1; /* sprite is visible when awake */ | ||
} |
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