Skip to content

Tag: code

Javascript Donut Animation

Couple of days ago I watched a Youtube video about donut animation by Lex Fridman. So I decided to copy-pasted his code and made a Javascript’s requestAnimationFrame( ) version of it. Since I didn’t make any delay for the animation, I was surprised how the browser can keep the frame rate around 60fps in my laptop. 🙂 Original donut article made by Andy Sloane at https://www.a1k0n.net/2011/07/20/donut-math.html. Andy made a great explanation about the algorithm, and even made an optimized version of it (without math sin/cos library) here: https://www.a1k0n.net/2021/01/13/optimizing-donut.html. Live version: https://web.tealtadpole.me/tt-javascript-donut/ Github code: https://github.com/tealtadpole/tt-javascript-donut – tt-

Leave a Comment

Naive String and Boyer Moore Javascript Implementation

Github link: https://github.com/tealtadpole/tt-boyer-moore-js https://github.com/tealtadpole/tt-naive-search-js I need a string search algorithm in one of my frontend project. String.protoype.indexOf( ) is of course good. It also accept start index as a second parameter. I made a simple function with indexOf( ) that return array of indexes. While googling about this topic, I found some interesting algorithms, which naive string search and boyer moore. So, I decided to try implementing both out of curiosity. Naive String Search Being the simplest string matching algorithm, I can’t find any research paper who developed the algorithm. Probably this method is the default method every freshmen at…

1 Comment