[PLUGIN] Canvas

From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • R0J0hound - another observation rather my requirement is not fulfilled , if I rotate the canvas then the touch.x - canvas.x does not work, it does not draw anything.

    Any formula which will work on any rotation.

  • socialpilgrim

    For everything except paste the coordinates to draw at are relative to a unrotated canvas.

    To have the point be the right spot you could use this equation to rotate around the canvas' center by the canvas' angle:

  • Hi R0j0hound, can you avail support of "ID" in your canvas plugin, so anyone can setup custom ID to canvas instance, I did change and it is working for me ... it is good if you do and make it official for all.

    It is just a suggestion.

  • Really nice Plugin! One problem though:

    When you use a canvas object in a family, the plugin somehow/somewhere calls /null which results in a 404. See browser inspector -> network panel.

    https://www.dropbox.com/s/8ve90rf4v6sil ... .capx?dl=0

    Edit: This causes some Browsers to not finish loading the game.

  • MrShortee

    Good to know. Fixed.

  • R0J0hound, I was wondering if there is any way I could make a color palette with canvas plugin using the gradient feature. One idea that I had was to use multiple small canvas objects on the screen with different color gradients. Is there any better way with a single canvas instance? Please let me know if this is possible?

    Since I can read the color value rgbaAT(touch.x,touch.y) using canvas plugin, I can apply that color to a Q3D model.

    EDIT : I was able to resolve this - Pasted a color palette image onto canvas. But after pasting the image, I lost some resolution of the palette...does the canvas paste use a color loss/reduction algorithm?

  • [quote:3mkuwc53]EDIT : I was able to resolve this - Pasted a color palette image onto canvas. But after pasting the image, I lost some resolution of the palette...does the canvas paste use a color loss/reduction algorithm?

    It doesn't but I have seen the color loss too. No idea how to correct it.

  • kmsravindra

    Instead of using rgbaAT you could just have a cosmetic image and deduce the color by the function that generated it at that x / y

  • QuaziGNRLnose, Thanks for the suggestion. I will try that.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It seems that i cant pass vars or object expressions values into an action with x y parameters. I confirmed it by adding my own action into the edittime/runtime file. It only accepts number values only exactly. Is this a problem with the canvas plugin or Construct 2 itself? This is the code i placed, to add the clearRect function.

    Edittime

    AddAnyTypeParam("x", "the x position on canvas", "0");

    AddAnyTypeParam("y", "the y position on canvas", "0");

    AddAnyTypeParam("width", "the width from x", "0");

    AddAnyTypeParam("height", "the height from y", "0");

    AddAction(31, 0, "Erase canvas", "Canvas", "Erase at mouse x/y on canvas", "Erase at mouse x/y on canvas", "eraseWithColor");

    Runtime

    acts.eraseWithColor = function (x, y, width, height)

    {

    var ctx=this.ctx;

    ctx.globalCompositeOperation = 'copy';

    ctx.fillStyle = "rgba(0,0,0,0)";

    ctx.clearRect(x,y,width,height);

    this.runtime.redraw = true;

    this.update_tex = true;

    }

  • It probably has to do with using the "any" type. The sdk has number type params too that probably works. With "any" I'd assume you'd have to convert it to a number or something.

  • It probably has to do with using the "any" type. The sdk has number type params too that probably works. With "any" I'd assume you'd have to convert it to a number or something.

    Actually i tried both, and with no luck. I even encapsulated it with int conversion, and it does nothing. I'll keep messing around, and see if i come up with something.

  • R0J0hound , I used canvas tool to create free hand curves and it works great. However the smoothing effect is missing in the free hand curves. Is there any way this can be converted to multiple beizer curves for smoothing effect as mentioned in this link - http://tavmjong.free.fr/INKSCAPE/MANUAL ... ating.html

    I believe this will be a very useful feature and greatly enhance the user experience with free hand drawn curves. Any pointers on how I can achieve this will be much appreciated. Thanks.

  • kmsravindra

    I guess it is possible but I'm unfamiliar with a method. Probably some kind of linear regression or something. Also it's something you'd do outside of the plugin.

  • Thank you.

Jump to:
Active Users
There are 3 visitors browsing this topic (0 users and 3 guests)