✩ TOBY ✩

He/it ♱ hispanic ♱ 20


things i love :D

fnaf 𖦏 inscryption 𖦏 creepypasta 𖦏 postal 𖦏 cry of fear 𖦏 afraid of monsters 𖦏 homestuck 𖦏 off 𖦏 ihnmaims 𖦏 digital art 𖦏 robots 𖦏 crywank 𖦏 porter robinson 𖦏 lifelover 𖦏 psychonaut 4 𖦏 hetzo


Where to find me


PERSONAL FOREST
PSYCHONAUT 4
const background = document.querySelector('#background'); // background derived from album cover below const thumbnail = document.querySelector('#thumbnail'); // album cover const song = document.querySelector('#song'); // audio object const songArtist = document.querySelector('.song-artist'); // element where track artist appears const songTitle = document.querySelector('.song-title'); // element where track title appears const progressBar = document.querySelector('#progress-bar'); // element where progress bar appears let pPause = document.querySelector('#play-pause'); // element where play and pause image appears songIndex = 0; songs = ['https://dl.dropbox.com/scl/fi/puozoy40r37u60k7i4r76/Personal-Forest.mp3?rlkey=xz9z92msimwhix6trh1hgcbu8&st=5nwrmdef&dl=0', 'https://dl.dropbox.com/scl/fi/pzasmyhbxkhva2rgwn9qg/Get-Scared-Cynical-Skin-with-lyrics-in-description.mp3?rlkey=4laa0t2g62gtwm4jug848i2c8&st=wf4e5d9z&dl=0']; // object storing paths for audio objects thumbnails = ['https://previews.dropbox.com/p/thumb/AC2jiVzeisldZlMHAhiPs8ZgvZ6ClJQUa9Dozhi4icFbuSnk1Dkbrnq7QoSOxtg-wiOm7lBlxBlIq7Z7ZF-UbW2OyntLOGQmbZJdii0KHYvr_GLxXkjDkxCA6311AKApKs4lBZ2ctYNcaJxB-v076PXpzE2bdMJaSSrYXfp-tU2a3dmuGsIlDRpxVLozKJACvqfFeBiva35W20t1wdqznlstIMPFh5894PpHZi9cKrtzGVd3FW5TuerN3mWpNalcYcTaD-TYhxZtHlLAHupNDwetV8RncFhgOCXCBixaZYeKnPmDS2sS2qZdh2cEzxWQ0U4/p.jpeg', 'https://previews.dropbox.com/p/thumb/AC2LZwvVxP2T794_TqTL88uyVHOTmigQpRrpz2G_-kM83Hy1G1aurDSWwh_s5wz-rQkgdnEIRX9ZI81bi5M9nz_ZGqTa7zQYHEJ6qd2TqY3SOzjVq0yKGbuzzAdp3GdEAwNvNvaaB-AbHxVRdk1ZCXRvQAI8A8Ww43a5LXHaB9w-ldpYVQOnmz2S4J-1HYPBNfZ4dFM8UXdhIAR3P1Ypdfa-Ebbwe29SaxcCmkmEn7vLr-gKgtVm8U12OYb3o-IjRGbWOFo2MocojbwYQcqGObZRqo0rA-7sbZHN2sXqjJcONBpxXzeB8Gv_MvR1QGhE1FE/p.jpeg']; // object storing paths for album covers and backgrounds songArtists = ['PERSONAL FOREST', 'CYNICAL SKIN']; // object storing track artists songTitles = ["PSYCHONAUT 4", "GET SCARED"]; // object storing track titles // function where pp (play-pause) element changes based on playing boolean value - if play button clicked, change pp.src to pause button and call song.play() and vice versa. let playing = true; function playPause() { if (playing) { const song = document.querySelector('#song'), thumbnail = document.querySelector('#thumbnail'); pPause.src = "https://gifcity.carrd.co/assets/images/gallery77/586531b7.gif?v=e3c0bc0f" thumbnail.style.transform = "scale(1.15)"; song.play(); playing = false; } else { pPause.src = "https://gifcity.carrd.co/assets/images/gallery77/eb674e5a.gif?v=e3c0bc0f" thumbnail.style.transform = "scale(1)" song.pause(); playing = true; } } // automatically play the next song at the end of the audio object's duration song.addEventListener('ended', function(){ nextSong(); }); // function where songIndex is incremented, song/thumbnail image/background image/song artist/song title changes to next index value, and playPause() runs to play next track function nextSong() { songIndex++; if (songIndex > 1) { songIndex = 0; }; song.src = songs[songIndex]; thumbnail.src = thumbnails[songIndex]; background.src = thumbnails[songIndex]; songArtist.innerHTML = songArtists[songIndex]; songTitle.innerHTML = songTitles[songIndex]; playing = true; playPause(); } // function where songIndex is decremented, song/thumbnail image/background image/song artist/song title changes to previous index value, and playPause() runs to play previous track function previousSong() { songIndex--; if (songIndex < 0) { songIndex = 1; }; song.src = songs[songIndex]; thumbnail.src = thumbnails[songIndex]; background.src = thumbnails[songIndex]; songArtist.innerHTML = songArtists[songIndex]; songTitle.innerHTML = songTitles[songIndex]; playing = true; playPause(); } // update progressBar.max to song object's duration, same for progressBar.value, update currentTime/duration DOM function updateProgressValue() { progressBar.max = song.duration; progressBar.value = song.currentTime; document.querySelector('.currentTime').innerHTML = (formatTime(Math.floor(song.currentTime))); if (document.querySelector('.durationTime').innerHTML === "NaN:NaN") { document.querySelector('.durationTime').innerHTML = "0:00"; } else { document.querySelector('.durationTime').innerHTML = (formatTime(Math.floor(song.duration))); } }; // convert song.currentTime and song.duration into MM:SS format function formatTime(seconds) { let min = Math.floor((seconds / 60)); let sec = Math.floor(seconds - (min * 60)); if (sec < 10){ sec = `0${sec}`; }; return `${min}:${sec}`; }; // run updateProgressValue function every 1/2 second to show change in progressBar and song.currentTime on the DOM setInterval(updateProgressValue, 500); // function where progressBar.value is changed when slider thumb is dragged without auto-playing audio function changeProgressBar() { song.currentTime = progressBar.value; };