1.0.6 • Published 1 year ago

@keodesign/proportional-image-normalisation v1.0.6

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
1 year ago

Proportional Image Normalisation

Scales images to be visually proportionate based on aspect ratio. An implementation of https://danpaquette.net/read/automatically-resizing-a-list-of-icons-or-logos-so-theyre-visually-proportional/

Class Parameters

  • @param {string} selector - An element selector for a set of elements to normalise
  • @param {int} widthBase - The width a square image would be scaled to
  • @param {int} scaleFactor - A balancing factor between scaling for height and width (i.e. aspect ratio bias). The default is generally visually balanced.
  • @param {Element} parentEl - A parent element to search for the selector. Defaults to document.

Sample Usage:

import { ProportionalImageNormalisation } from "@keodesign/proportional-image-normalisation";
proportionalImageNormalisation(".banners-home .banner-inner-image", 40, 0.525, document.querySelector("header"));
1.0.6

1 year ago

1.0.5

2 years ago

1.0.4

3 years ago