0.0.2 • Published 6 years ago
ngx-image-blur v0.0.2
NgxImageBlur
Simple image blur loader component for Angular >= 2, inspired by image blur loading on Medium.
Installation
npm install --save ngx-image-blur- Edit your app.module file:
...
import { NgxImageBlurModule } from 'ngx-image-blur';
@NgModule({
...
imports: [
...
NgxImageBlurModule
],
...
})Usage
Type Definitions:
type LazyMode = 'eager' | 'half-lazy' | 'lazy'eager- image starts loading as soon as the page loads and does its blur transitions as soon as it canhalf-lazy- image starts loading as soon as the page loads, but delays the blur transition until it comes into viewlazy- image starts loading only once it comes into view
@Input() options:
heightstring - desired height of image e.g. '50vh' (required)widthstring - desired width of image e.g. '500px' (required)previewSrcstring - link that can go in a url() (e.g. web link or assets path) to smaller thumbnail version of image (required)widthstring - link that can go in a url() (e.g. web link or assets path) to full image (required)blurPixelsinteger - how much blur to apply to the preview image (defaults to 8)transitionDurationinteger - time in ms to take for the transition between preview and fill images (defaults to 500, i.e. half a second)objectFitstring - CSS object-fit for the image (defaults to 'cover')lazyModeLazyMode - which LazyMode to use for image loading - see above (defaults to 'eager')