Recently I have been working on a project where a user can change some values inside a UI widget via form elements like input fields, range, etc. that would in turn change CSS code inside a CodeMirror editor which would reflect changes inside an iframe sandbox (like cssdeck, jsfiddle, etc.).
Continue reading “Parsing CSS In Javascript”
Category: Tools & Tips
Fixing Node Mysql “Error: Cannot enqueue Handshake after invoking quit.”
TL;DR You need to establish a new connection by calling the createConnection
method after every disconnection.
Continue reading “Fixing Node Mysql “Error: Cannot enqueue Handshake after invoking quit.””
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.
Continue reading “Controlling the Frame Rate with requestAnimationFrame”
Canvas Text Gradients for Backgrounds and Strokes
Text gradients are super easy to achieve with HTML5 Canvas.
Continue reading “Canvas Text Gradients for Backgrounds and Strokes”
Moving/Scrolling/Sliding Background in HTML5 Canvas
Sometimes your game or canvas experiment might have one or more layers of animating backgrounds that are set in motion for the player’s movement or some other reason (like creating a parallax effect?). Just had to do something similar the other day. The problem is tricky but with a bit of thinking it seems like I came up with a proper solution!
Continue reading “Moving/Scrolling/Sliding Background in HTML5 Canvas”
Drawing Text on HTML5 Canvas
Writing Text on canvas is pretty straightforward. All we need to know about is certain properties and methods that are pre-defined on the canvas’s context. You can draw/write all unicode characters using the related methods.
WebSocket Traffic Inspection in Chrome Developer Tools
Just like debugging any other thing, doing the same for websocket traffic can be really useful. Not sure if firebug does that, but inspecting your websocket traffic in chrome dev tools is definitely possible.
Continue reading “WebSocket Traffic Inspection in Chrome Developer Tools”