I would like to understand if it is possible instead to make sure that a data collected with the javascript part can modify one in the css specifically based on a number returned by the javascript code you change the speed of the transitions in the css (I put the js code created below from @elikoga)
// script to check how long a button has been pressed
const button = document.querySelector('button');
const div = document.querySelector('div');
let startTime;
let endTime;
// attach event listener to button
button.addEventListener('mousedown', (e) => {
startTime = new Date();
});
// attach event listener to button
button.addEventListener('mouseup', (e) => {
endTime = new Date();
const timeDiff = endTime - startTime;
div.textContent = `You pressed the button for ${timeDiff} milliseconds`;
});
<button>Press me!</button>
<div></div>