Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay in slider when multiple filter applies #23

Open
moham-MA-d opened this issue Aug 19, 2014 · 0 comments
Open

Delay in slider when multiple filter applies #23

moham-MA-d opened this issue Aug 19, 2014 · 0 comments

Comments

@moham-MA-d
Copy link

I want to use multiple Jquery slider for multiple filters, "Brightness / Contrast", "Denoise ", "Triangle Blur".
But applying filter is done with delay (about 1s) when the slide is fired.
this is my code:
` window.onload = function () {
var canvas = fx.canvas();
var image = document.getElementById('image');
var texture = canvas.texture(image);
$('#image').replaceWith(canvas)
canvas.draw(texture).triangleBlur(0).update();
canvas.draw(texture).denoise(50).update();

    texture.destroy();
    texture = canvas.contents();

    $("#SliderTriangleBlur").slider({
        range: "min",
        min: 0,
        max: 200,
        value: 0,
        slide: function (event, ui) {
           $("#AmountTriangleBlur").val(ui.value);
           var dNoise = $("#SliderDenoise").slider("option", "value");
           var Brightness = $("#SliderBrightness").slider("option", "value");
           var Contrast = $("#SliderContrast").slider("option", "value");
           canvas.draw(texture).denoise(dNoise).brightnessContrast(Brightness, Contrast).triangleBlur(ui.value);
           canvas.update();
        }
    });
    $("#AmountTriangleBlur").val($("#SliderTriangleBlur").slider("value"));


    $("#SliderDenoise").slider({
        range: "min",
        min: 0,
        max: 50,
        value: 50,
        slide: function (event, ui) {
            $("#AmountDenoise").val(ui.value);
            var triBlur = $("#SliderTriangleBlur").slider("option", "value");
            var Brightness = $("#SliderBrightness").slider("option", "value");
            var Contrast = $("#SliderContrast").slider("option", "value");
            canvas.draw(texture).triangleBlur(triBlur).brightnessContrast(Brightness, Contrast).denoise(ui.value);
            canvas.update()

        }
    });
    $("#AmountDenoise").val($("#SliderDenoise").slider("value"));



    $("#SliderBrightness").slider({
        range: "min",
        min: -1,
        max: 1,
        step: 0.01,
        value: 0,
        slide: function (event, ui) {
            $("#AmountBrightness").val(ui.value);
            var triBlur = $("#SliderTriangleBlur").slider("option", "value");
            var dNoise = $("#SliderDenoise").slider("option", "value");
            var Contrast = $("#SliderContrast").slider("option", "value");
            canvas.draw(texture).triangleBlur(triBlur).denoise(dNoise).brightnessContrast(ui.value, Contrast);
            canvas.update()

        }
    });
    $("#AmountBrightness").val($("#SliderBrightness").slider("value"));




    $("#SliderContrast").slider({
        range: "min",
        min: -1,
        max: 1,
        step: 0.01,
        value: 0,
        slide: function (event, ui) {
            $("#AmountContrast").val(ui.value);
            var triBlur = $("#SliderTriangleBlur").slider("option", "value");
            var dNoise = $("#SliderDenoise").slider("option", "value");
            var Brightness = $("#SliderBrightness").slider("option", "value");

            canvas.draw(texture).triangleBlur(triBlur).denoise(dNoise).brightnessContrast(Brightness, ui.value);
            canvas.update();

        }
    });
    $("#AmountContrast").val($("#SliderContrast").slider("value"));









};

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant