Skip to content

Instantly share code, notes, and snippets.

View samueleastdev's full-sized avatar

Samuel East samueleastdev

View GitHub Profile

Saved for my personal reference, all content belongs to codetheory.in

Controlling the Frame Rate with requestAnimationFrame

Limiting the frame rate while using requestAnimationFrame can be a common want especially when coding Games where you want your animations and mechanics to not exceed a particular mark of frames per second. Let’s go through 2 ways of doing it.

Quick and Easy Way

Using setTimeout inside the rAF method is an easy way.

@2ajoyce
2ajoyce / PasteInGitBash.ahk
Last active October 5, 2022 09:43
Autohotkey Paste In Git Bash
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 1
I_Icon = C:\Program Files\AutoHotkey\Letter Icons\paste.ico
ICON [I_Icon] ;Changes a compiled script's icon (.exe)
if I_Icon <>
IfExist, %I_Icon%