Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oglimage

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oglimage

oglimage is a concise JavaScript library based on OGL, enabling the conversion of DOM images into flat 3D images on a WebGL canvas.

  • 0.0.6
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Image-OGL

⚠️ BETA ⚠️

oglimage is a concise JavaScript library based on OGL, enabling the conversion of DOM images into flat 3D images on a WebGL canvas.

Install


npm i oglimage

Basic setup


import Experience from "oglimage"

const experience = new Experience()

const myImage = document.querySelector(".my-image")

experience.addImage(myImage)

Instance setting


OptionTypeDefaultDescription
containerHTMLElementdocument.bodySpecifies the DOM element for the canvas.
alphabooleantrueEnables canvas transparency.
antialiasbooleantrueToggles antialiasing for smoother rendering.
dprnumberMath.min(window.devicePixelRatio, 2)Sets the device pixel ratio for the canvas.
scrollobjectfalse → browser scrollChange the current value to your own scroll

Instance Method: addImage(image, options)

OptionTypeDescription
imageHTMLImageElement or nullThe image to be transformed into a WebGL-renderable format.
optionsObjectConfiguration options for the transformation.
vertex (optional)Custom vertex shader.
fragment (optional)Custom fragment shader.
uniforms (optional)A function that returns custom uniforms.

Example

// ...
experience.addImage(myImage, {
    vertex: vertex,
    fragment: fragment,
    uniformes: {
      uStrength: { value: 0.5 },  
    }
})

FAQs

Package last updated on 25 Dec 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc