npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

element-functions-set_background_canvas

v3.0.0

Published

Sets an Image or GLSLFragmentShader as the background of any Element.

Downloads

6

Readme

setBackgroundCanvas

Sets an Image or GLSLFragmentShader as the background of any Element.

This functions allows you to apply a Image or GLSLFragmentShader behind all element children. By using this function you will have far more control. The main reason for this was to allow opacity over an still background image without effecting nested elements. Now each nested element can have its own alpha use setAlpha project for this. Use the opacity rule for the canvas.

Make sure your parent Element has the CSS rule position: relative;.

Demostration Site

    img1.onload = function () {
        
        document.getElementById("your_block_level_element").setBackgroundCanvas(img1);

    };
    img1.crossOrigin = "anonymous"; /* required removes: operation is insecure */
    img1.src = 'https://upload.wikimedia.org/wikipedia/commons/9/9b/The.Matrix.glmatrix.2.png';
   /* create a function for Loaded event within parent element */
   parentElement.glslFragmentShaderLoaded = function(event){
   	/* set your size */
            glslFragmentShader.size = 4; // between .5 - 8
	
	/* add to the background */
	 parentElement.setBackgroundCanvas(glslFragmentShader);

	
   }

You can access the canvas element directly by using

You can access the reFresh function if you have any refreshing issues with

Triggered when a change to the canvas object.

By including this module you will get an extra reFresh call.

To reposition the image use two classes on the canvas element, both x and y classes are needed.

9 positions are possible

So for a center image use

The object ether image, video can be stretched over the element, using the following classes. aspect ratio is ignored.

Use the opacity rule, inheritance will not be effected as it's on it own branch.

Levels were added for manipulation of pixels just in case there is some chroma pixels remaining. The class of levels must be added to the Element or it will be ignored

Apply a color of chroma key to the GLSLFragmentShader or Image the class of chromaKey must be added to the canvas element to function, make sure you slect the exact colour of the chroma key.

Apply an amount of chroma variance to the GLSLFragmentShader or Image the class of chromaKey must be added to the canvas element to function