yomotsu / gl-slideshow

A JavaScript library for advanced 2D slideshow with WebGL, that provides variety of beautiful effects
83 stars 12 forks source link

Shader example #6

Closed WideCircle closed 3 years ago

WideCircle commented 4 years ago

Hi! I'm trying to make my own transition effect. So I checked out the shader.html I noticed it makes no difference what value I write in the variabel 'uniforms' for the smoothness. It always has sharp edges.

const uniforms = {
    smoothness: { value: 1,  type: 'float' }
};

So I went to https://gl-transitions.com/editor/ and pasted in the code there. In the editor it works as expected with smooth edges.

Am I doing something wrong?

Really like the slider by the way. Good job!

Best, Niklas

yomotsu commented 4 years ago

thanks for using the lib. actually, uniforms must be like this.

const uniforms = {
    smoothness: 1,
};

Sorry for the confusion. I updated the example.

WideCircle commented 4 years ago

Aha! Thank you & no problem. I will check this out!

One more question: :) Are the imgs preloaded (good at slower connections) or is that something I should take care of myself?

yomotsu commented 4 years ago

regarding your second question, the slider will load the images if it is not loaded. ~But I just realized, if images have been already loaded, might not work.~ <- I tested and that's no matter.

If an image is not loaded, the slider will show in black for the image, and replace it to the loaded image after loading. You can also pass loaded images to the constructor.

Slider constructor takes

WideCircle commented 4 years ago

Works like a charm!! Thanks for your help!

WideCircle commented 4 years ago

Hi again! :-) Hmm - I'm trying use this effect https://gl-transitions.com/editor/randomsquares I can't figure out how to deal with ivec2. If I use this:

const uniforms = {
    smoothness: 0.5,
    size: ivec2(10, 10)
};

I get an error message that ivec2 is undefined...how do I deal with this?

Best, Niklas

yomotsu commented 4 years ago

Pass an array