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

No error, but still not working... #28

Open
NoBodyButMe opened this issue Sep 6, 2019 · 0 comments
Open

No error, but still not working... #28

NoBodyButMe opened this issue Sep 6, 2019 · 0 comments

Comments

@NoBodyButMe
Copy link

I have this code, can you explain why this doesn't show any result?

    var c = document.getElementById("c2");
    var ctx = c.getContext("2d");

    // Create gradient
    var grd = ctx.createLinearGradient(0, 0, 200, 0);
    grd.addColorStop(0, "red");
    grd.addColorStop(1, "white");

    // Fill with gradient
    ctx.fillStyle = grd;
    ctx.fillRect(10, 10, 150, 80);
         /*webassembly*/
        let wam;
        loadWASM()
          .then(module => {
            wam = module;
        }).catch((err) => {
          console.log('Error in fetching module: ', err);
        }).then(() => {
            window.onload = (() => {
                var pixels = ctx.getImageData(0, 0, 400, 300);
                //console.log(pixels);
                var xx = pixels.data.set(wam.goodMorning(pixels.data, 400, 300));
                //var xx = wam.goodMorning(pixels.data, 400, 300);
                //console.log(xx);
                pixels.data.set(xx);
            })();
        });
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