News for hackers. Stuff that matters.
Re:Breaking down a ripple animation in JavaScript by nayuki on Thursday August 19, 2021 @04:08PM (#28238700)

    let distance = hypotenuseLength(reIndexedX, reIndexedY);
    
    function hypotenuseLength(x, y) {
      return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
    }
The above can be replaced with:

    let distance = Math.hypot(reIndexedX, reIndexedY);
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re:Breaking down a ripple animation in JavaScript by wizzwizz4 on Thursday August 19, 2021 @04:16PM (#28238805)
It's a tutorial, so there's a benefit to writing out the separate function in the article, but given that it's “in JavaScript” I agree with your suggestion.
Re:Breaking down a ripple animation in JavaScript by bryanbraun on Friday August 20, 2021 @10:16PM (#28253483)
Haha, yeah I discovered this after I wrote it. Probably worth going back and updating.