Zooming into Flexibility: Harnessing Image Scaling with Zooming.js

In the era where digital visualization is key, zooming.js emerges as a cornerstone for developers aiming to implement image scaling features swiftly. It's a JavaScript library that doesn't just stop at scaling; it extends its prowess to translation and rotation, making image manipulation a breeze. Built with TypeScript, it also caters to those valuing development efficiency and code quality. The library unfolds a suite of customization options to meet various scaling needs, ensuring no project has to compromise on its visual interactiveness.

Let's delve into the simplicity and power of zooming.js through some examples:

  1. Simple Scaling:
  2. Translation and Scaling:
  3. Rotation and Scaling:

Getting started with zooming.js is straightforward. Post-installation via npm, it seamlessly integrates into your HTML file. Create a Zooming instance and harness the scale, translate, and rotate methods to achieve the desired image manipulation.

A Touch More Customization:

import { Zooming } from "zooming";

const zooming = new Zooming(document.querySelector("img"));

zooming.scale({
  x: 2, // Scales horizontally to twice the original size
  y: 1.5, // Scales vertically to 1.5 times the original size
});

Event Listeners for Interactive Feedback:

import { Zooming } from "zooming";

const zooming = new Zooming(document.querySelector("img"));

zooming.on("zoom", () => {
  // Triggered during zoom
});

zooming.on("translate", () => {
  // Triggered during translation
});

zooming.on("rotate", () => {
  // Triggered during rotation
});