Socket
Socket
Sign inDemoInstall

@dodoroy/blur-viewer

Package Overview
Dependencies
14
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @dodoroy/blur-viewer

blur effect


Version published
Weekly downloads
4
Maintainers
1
Created
Weekly downloads
 

Readme

Source

blur-viewer

About

view the blurred image with mouse move screen

Usage

  1. include the script
<script type="text/javascript" src="blur-viewer.js"></script>
  1. add wrapper and svg template in html with id 'blur-template'
  <div class="blur-wrapper"><img class="blur-image" src="./images/pic1.jpg" alt=""></div>
  
  <script type="text/template" id="blur-template">
    <svg class="blur" width="100%">
        
      <filter id="{{filter}}">
        <feGaussianBlur stdDeviation="10" color-interpolation-filters="sRGB"/>
      </filter>

      <mask class="mask" id="{{mask}}">
        <circle cx="-50%" cy="-50%" r="120" fill="white" filter="url(#{{filter}})" />
      </mask>

      <image xlink:href="{{image}}" width="100%" height="100%" filter="url(#{{filter}})" ></image>
      <image xlink:href="{{image}}" width="100%" height="100%" mask="url(#{{mask}})"></image>
    </svg>
  </script>
  1. call BlurViewer with new
let blurElements = document.querySelector('.blur-wrapper');
blurElement.blurViewer = new dodoroy.BlurViewer(blurElement);

Credit

Created by @dodo糯, blog

Keywords

FAQs

Last updated on 12 Dec 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc