Skip to content

Commit

Permalink
maybe fix volume bug
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasperz committed Dec 2, 2022
1 parent 78f5fb7 commit b758cec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 12 additions & 3 deletions src/experiments/39.ffflauta-scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,15 +439,24 @@ const AudioButton = ({ interacted }) => {
)

useEffect(() => {
if (!shouldBeMuted) {
music.mute(shouldBeMuted)
if (interacted) {
music.mute(false)
}
}, [music, interacted])

useGsapContext(() => {
const fromTo = [0, 0.5]

shouldBeMuted && fromTo.reverse()

music.fade(...fromTo, 1500)
const volume = { value: fromTo[0] }

gsap.to(volume, {
value: fromTo[1],
duration: 1.5,
ease: 'none',
onUpdate: () => music.volume(volume.value)
})
}, [music, shouldBeMuted])

useEffect(() => {
Expand Down
4 changes: 0 additions & 4 deletions src/hooks/use-image-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ export const useProgress = create<State>((set, get) => {

if (alreadyExists) return

console.log('Register', id)

set({ store: { ...store, [id]: { object, complete: false } } })
set({ progress: getProgress() })
},
Expand All @@ -44,8 +42,6 @@ export const useProgress = create<State>((set, get) => {
/* If doesn't exist or if already complete return */
if (trgtObj === undefined || trgtObj?.complete) return

console.log('Complete for', id)

set({
store: {
...store,
Expand Down

1 comment on commit b758cec

@vercel
Copy link

@vercel vercel bot commented on b758cec Dec 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.