-
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.
- Music modes screens - Added Background image and Icon to Music mode model
- Loading branch information
Showing
14 changed files
with
1,133 additions
and
680 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,75 @@ | ||
import DefaultScreen from './defaultScreen'; | ||
|
||
export default class MusicModes extends DefaultScreen { | ||
|
||
private interval: NodeJS.Timeout; | ||
|
||
animateIn() { | ||
super.animateIn(); | ||
|
||
const timer = this.content.parentElement.querySelector<HTMLDivElement>('.timer'); | ||
if (timer) { | ||
timer.classList.add('timer-music-modes'); | ||
} | ||
|
||
const wrapper = this.content.querySelector<HTMLElement>('.music-modes-wrapper'); | ||
if (!wrapper) { | ||
return; | ||
} | ||
|
||
const height = wrapper.getBoundingClientRect().height; | ||
if (height >= wrapper.scrollHeight) { | ||
return; | ||
} | ||
|
||
let bottom = false; | ||
this.interval = setInterval(() => { | ||
this.scroll(wrapper, bottom ? 0 : wrapper.scrollHeight - height, 10000); | ||
bottom = !bottom; | ||
}, 15000); | ||
} | ||
|
||
animateOut() { | ||
super.animateOut(); | ||
if (this.interval) { | ||
clearInterval(this.interval); | ||
} | ||
|
||
const timer = this.content.parentElement.querySelector<HTMLDivElement>('.timer'); | ||
if (timer) { | ||
timer.classList.remove('timer-music-modes'); | ||
} | ||
} | ||
|
||
showTimer(): boolean { | ||
return true; | ||
} | ||
|
||
private scroll(wrapper: HTMLElement, scrollTo: number, duration: number, callback: null | (() => void) = null) { | ||
let start: number, previousTimeStamp: number; | ||
|
||
const startScroll = wrapper.scrollTop; | ||
const scrollBy = scrollTo - startScroll; | ||
|
||
function scroll(timeStamp: number) { | ||
if (start === undefined) { | ||
start = timeStamp; | ||
} | ||
const elapsed = timeStamp - start; | ||
|
||
if (previousTimeStamp !== timeStamp) { | ||
wrapper.scrollTop = startScroll + (scrollBy * (elapsed / duration)); | ||
} | ||
|
||
if (elapsed > duration) { | ||
callback && callback(); | ||
return; // Stop animation after duration | ||
} | ||
previousTimeStamp = timeStamp; | ||
window.requestAnimationFrame(scroll); | ||
} | ||
|
||
window.requestAnimationFrame(scroll); | ||
} | ||
|
||
} |
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,84 @@ | ||
#gate main { | ||
.timer.timer-music-modes { | ||
bottom: initial; | ||
left: 2rem; | ||
top: calc(26% - 3rem); | ||
width: calc(20% - 1.2rem); | ||
} | ||
|
||
.content.music-modes-screen { | ||
grid-template-areas: 'logo logo music music music music music music music .' | ||
'. . music music music music music music music .' | ||
'. . music music music music music music music .' | ||
'. . music music music music music music music .'; | ||
|
||
.music-modes-wrapper { | ||
display: grid; | ||
grid-area: music; | ||
grid-auto-rows: min-content; | ||
grid-gap: 1rem; | ||
grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); | ||
height: 100%; | ||
overflow-y: auto; | ||
scrollbar-width: none; | ||
width: 100%; | ||
|
||
&::-webkit-scrollbar { | ||
display: none; | ||
} | ||
|
||
.music-mode { | ||
backdrop-filter: blur(10px); | ||
background-color: rgba(255, 255, 255, 0.4); | ||
border-radius: 1rem; | ||
overflow: hidden; | ||
padding: 1rem; | ||
position: relative; | ||
|
||
* { | ||
z-index: 2; | ||
} | ||
|
||
.background { | ||
filter: blur(5px) brightness(.6); | ||
height: 100%; | ||
left: 0; | ||
object-fit: cover; | ||
position: absolute; | ||
top: 0; | ||
width: 100%; | ||
z-index: -1; | ||
} | ||
|
||
.name { | ||
color: #fff; | ||
font-size: 1.75rem; | ||
font-weight: bold; | ||
} | ||
|
||
.icon { | ||
margin-bottom: .5rem; | ||
|
||
> * { | ||
height: 2.5rem; | ||
width: auto; | ||
} | ||
|
||
svg { | ||
path { | ||
fill: #fff; | ||
} | ||
} | ||
|
||
img { | ||
|
||
} | ||
} | ||
|
||
.children { | ||
color: #fff; | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.