3.0.0 • Published 5 years ago

element-functions-set_background_canvas v3.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

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';
   }

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.

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

3.0.0

5 years ago

2.0.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago