Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
totaro committed Jan 3, 2024
1 parent 2b35869 commit 49936f5
Showing 1 changed file with 24 additions and 34 deletions.
58 changes: 24 additions & 34 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
//preloader ---------------------------
//preloader -------------------------------------------

const loaderContainer = document.querySelector('.loader-container')

window.addEventListener('load', () => {
loaderContainer.classList.add('hidden')


})




// gsap scrolltrigger ------------------------------------

const entries = document.querySelectorAll('.entry')

entries.forEach(entry => {
Expand All @@ -35,9 +32,7 @@ entries.forEach(entry => {
})




//lenis gsap
//lenis gsap scrolltrigger
/*
const lenis = new Lenis()
Expand All @@ -50,54 +45,48 @@ gsap.ticker.add((time)=>{
gsap.ticker.lagSmoothing(0)
*/

//menu button toggle ----------------------------------
//menu button toggle ---------------------------------------

const menuButton = document.querySelector('#menu-button')
const rootElement = document.documentElement
const menuLink1 = document.querySelector('#menu-link')
const menuLinks = document.querySelectorAll('#menu-link')


menuButton.addEventListener('click', () => {
rootElement.toggleAttribute('menu-open')
})

var count = 0;
menuLinks.forEach(menulink => {

menulink.addEventListener('click', () => {
//console.log("Clicked! count:" + ++count);
rootElement.toggleAttribute('menu-open')
menulink.addEventListener('click', () => {
//console.log("Clicked! count:" + ++count);
rootElement.toggleAttribute('menu-open')
})


})



// animated submit button --------------------------------------

const submitButton = document.querySelector('#btn-submit')
const submitButtonText = document.querySelector('#btn-submit .button--text')

submitButton.addEventListener('click', (e) => {
submitButton.addEventListener('click', (e) => {

e.preventDefault()
e.preventDefault()

//add loading class
submitButton.classList.add('loading')
//add loading class
submitButton.classList.add('loading')

setTimeout(() => {
//remove loading class
submitButton.classList.remove('loading')
submitButton.classList.add('success')
setTimeout(() => {
//remove loading class
submitButton.classList.remove('loading')
submitButton.classList.add('success')

//change button text
submitButtonText.innerHTML = 'Login Successful'
//change button text
submitButtonText.innerHTML = 'Login Successful'

}, 3000)
})

// typewriter effect ---------------------------------
// typewriter effect --------------------------------------------

const words = ['Style', 'Clarity', 'Passion', 'Precision']

Expand Down Expand Up @@ -131,7 +120,7 @@ words.forEach(word =>{

})

//blinkin cursor
//blinkin cursor
let cursorTimeline = gsap.timeline({
repeat: -1,
repeatDelay: .8
Expand Down Expand Up @@ -163,9 +152,10 @@ const activateMagnet = (event) => {
const newY = ((event.clientY - boundBox.top)/magnet.offsetHeight - 0.5)

//debugging purposes
/*
dngr.innerHTML = 'cursorX ' + event.clientX + '<br>boxleft: ' + Math.ceil(boundBox.left) + '<br>cursorInsideButton: ' + Math.ceil(event.clientX - boundBox.left) + '<br>relativeToTotalWidth: ' + ((event.clientX - boundBox.left)/magnet.offsetWidth).toFixed(2) + '<br>shifted: ' + ((event.clientX - boundBox.left)/magnet.offsetWidth - 0.5).toFixed(2)

//move button to its new posistion
*/
//move button to its new position
gsap.to(magnet, {
duration: 1,
x: newX * magnetStrength,
Expand Down

0 comments on commit 49936f5

Please sign in to comment.