r/javascript • u/kiarash-irandoust • Mar 14 '19
r/javascript • u/thelinuxlich • Apr 29 '25
go-go-try: Golang-style error handling for JS/TS
r/javascript • u/indigo-rose-girl • Oct 27 '22
What Is Deno and Why You Should Try It
r/javascript • u/nuatik • Dec 29 '17
help Can i learn JavaScript?
Hi, i am 29 and dont know anything about coding. But, i am very willing to learn and work at this. How can i start and what should i do? After learning JS can i work as a frontend developer? Any suggestions?
r/javascript • u/[deleted] • Nov 19 '14
Dicks API - Dicks as a service
dicks-api.herokuapp.comr/javascript • u/Kiwi_Taster • Oct 22 '19
Dead-Simple JavaScript Components w/o the overhead
r/javascript • u/alexcasalboni • Mar 20 '15
Forget SASS, it's all about DICSS now
letsgetrandy.github.ior/javascript • u/flowforfrank • Jun 30 '22
What is Fresh? - Taking a look at a fresh new web framework
r/javascript • u/gst • Jan 08 '11
Underscore.js javascript Library for functional programing
xahlee.blogspot.comr/javascript • u/Maximum_Beat2034 • Aug 02 '26
AskJS [AskJS] Building a 2D Game Engine from scratch in pure ES6 Vanilla JS. Here is how I handle SpriteSheets & AnimatedSprites!
Hi everyone!
I've been working on BeeEngine 2D, a lightweight HTML5 game engine built with pure Vanilla JS (ES6) and direct Canvas API—no external libraries, no build tools, and zero heavy frameworks.
A lot of modern tools hide sheet slicing behind JSON files, but I wanted a bare-metal, highly efficient approach that gives 100/100 on Lighthouse Performance and instant loading times.
I separated the asset slicing logic from the animation timing logic into two distinct classes:
BeeSpriteSheet: Handles frame dimensions, columns, rows, and coordinate calculations.BeeAnimatedSprite: Handles frame timing, state, loops, andflipXtransformations.
Here is my BeeAnimatedSprite class implementation:
export class BeeAnimatedSprite {
constructor(spriteSheet, config = {}) {
this.sheet = spriteSheet;
this.animations = config.animations || {};
this.currentAnimName = config.animation || Object.keys(this.animations)[0];
this.currentFrameIndex = 0;
this.timer = 0;
this.flipX = false;
}
play(name) {
if (this.currentAnimName !== name && this.animations[name]) {
this.currentAnimName = name;
this.currentFrameIndex = 0;
this.timer = 0;
}
}
update(dt) {
const anim = this.animations[this.currentAnimName];
if (!anim || !anim.frames || anim.frames.length === 0) return;
const fps = anim.fps || 8;
const frameDuration = 1 / fps;
this.timer += dt;
if (this.timer >= frameDuration) {
this.timer -= frameDuration;
if (anim.loop) {
this.currentFrameIndex = (this.currentFrameIndex + 1) % anim.frames.length;
} else {
this.currentFrameIndex = Math.min(this.currentFrameIndex + 1, anim.frames.length - 1);
}
}
}
draw(ctx, x, y, options = {}) {
const anim = this.animations[this.currentAnimName];
if (!anim) return;
const frameToDraw = anim.frames[this.currentFrameIndex];
const width = options.width || this.sheet.frameWidth;
const height = options.height || this.sheet.frameHeight;
ctx.save();
if (this.flipX) {
// 2. Sposta l'origine al bordo destro dell'immagine e specchia l'asse X
ctx.translate(x + width, y);
ctx.scale(-1, 1);
this.sheet.drawFrame(ctx, frameToDraw, 0, 0, width, height);
} else {
// Disegno normale senza specchio
this.sheet.drawFrame(ctx, frameToDraw, x, y, width, height);
}
ctx.restore();
}
}
And here is how
I implemented it inside main.js:
const megaSheetImg = gioco.getAsset('spritesheet_totale');
const frameW = 128;
const frameH = 128;
const apeSheet = new BeeSpriteSheet(megaSheetImg, frameW, frameH, {
col: 3,
row: 3,
framesPerRow: 1,
frameCount: 2
});
this.giocatore.sprite = new BeeAnimatedSprite(apeSheet, {
animation: "fly",
animations: {
fly: { frames: [0, 1], fps: 4, loop: true }
}
});Let me know what you think, bearing in mind that this particular combination is super quick to put together.
r/javascript • u/copperfoxtech • Nov 01 '24
AskJS [AskJS] Which JS is best for backend development and why?
I was at my co-working space and met some Devs that do mobile app development. I assumed it would be with swift or something else. They told me that they use JS and wrap it or use a pipeline.
I am a python backend developer and was curious which JS is used for backend development for web apps and mobile apps. I'm thinking about learning something new to open up career paths.
r/javascript • u/EvanAtNeon • Apr 04 '24
Building a Next.js application using Clerk for Authentication, and Drizzle ORM with Postgres for Storage
r/javascript • u/cranktank • Nov 18 '13
Real-time live search of whole Wikipedia in less than 20 lines of JavaScript
liveweave.comr/javascript • u/rwiguna • Aug 27 '15
The Evil Side of JavaScript: Server-Side JavaScript Injection
blog.nvisium.comr/javascript • u/fagnerbrack • Jul 20 '26
Your Recursion Is Lying to You
r/javascript • u/tarasm • Aug 12 '25
The Heart Breaking Inadequacy Of AbortController
This blog post says that AbortController is a standard but it's rarely used. Do you agree? Do you find it lacking like the blog post suggests?
r/javascript • u/piyasde2014 • Feb 27 '14
total.js - a node.js web framework and its benefits...
r/javascript • u/callumacrae • Mar 28 '14
console.loge - Doge for your browser
zachinglis.comr/javascript • u/legacye • May 02 '10
31 jQuery Snippets That Will Help Make You A JavaScript Pro
addyosmani.comr/javascript • u/kasperpeulen • Oct 24 '16
help The only thing I hate about const ...
... is that it is 5 chars long.
For some reason, let with its 3 chars, looks more elegant.
r/javascript • u/Anutamme • Aug 28 '25
AskJS [AskJS] Is using libraries okay?
Hey, I'm a beginner in frontend development and I'm unsure when I should code something from scratch and when I should use ready-made libraries. For example, if I want to create a fade-in effect – should I write it myself in CSS/JS, or use something like AOS? Or if I want to make a slider – is it better to code it from scratch or use something like Swiper.js?
r/javascript • u/[deleted] • Mar 26 '16