[PLUGIN] Canvas

From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • rexrainbow : you're right, you need to load it into in image and paste it.

  • I had made a behavior to load image from url for canvas plugn, this code was modified from sprite.

  • Would it be possible to add a "fill path with gradient" command to this plugin?

  • Hello,

    I thought this issue was related to the Canvas plugin, but when I remove everything but the canvas it wasn't happening anymore, so trial and error to find out it might also be related to the platform behavior. But, I'm posting it here because the Canvas plugin is the part that isn't native (and seems like it may be the issue).

    When a canvas and a sprite(with the platform behavior) are in the layout there is a notable decrease in FPS. Even if neither is doing anything. But ONLY when webgl is "on". Even though nothing is using webgl as far as I can tell (maybe I missed something).

    Here is a capx example:

    http://dl.dropbox.com/u/659906/canvas_test.capx

    Sorry for the complicated button presses to show FPS. But I wanted to make sure the text was not part of the issue.

    In this capx, you press "enter" to save the fps to a variable, then hold "space" to show it on screen. When you release space the text will be destroyed.

    Enter- save fps to variable

    Space (Hold)- display saved variable on screen.

    Space (Release)- destroy text on screen

    1- destroy sprite with "platform" behavior

    2- create sprite with "platform" behavior

    0- destroy canvas

    9- create canvas

    If you destroy the sprite or the canvas, the FPS picks up to 60. If you add more than one sprite, there is no change in FPS. If you add more than one canvas there is additional drop of FPS.

    also, if you turn off webgl there is no issue with fps.

    I would appreciate a second set of eyes here, as well as any suggestions on what I may be doing wrong.

    Additionally, I'd like to say this is an issue that came about with the newest C2 release, but I've yet to uninstall/reinstall/test.

  • cymrix

    It's a known issue with the canvas plugin. The plugin was originally made using just canvas2d (or no webgl). With webgl enabled every time the object draws, it's image is copied to a texture so it can be drawn, this is what causes the fps drop. The recommended solution is to set webgl to off.

  • I see. Thank you.

    Now that I know what to search for I've found other threads with the same issue. Sorry about that.

    Here is a good thread about it:

    http://www.scirra.com/forum/canvas-object-webgl-memory-issue-solved_topic49105.html

  • Hello.

    R0J0hound, on canvas resize the contents get deleted. Is that the intended behaviour?

  • Yes, it changes the size of the canvas texture, the image itself is discarded.

  • Hi everyone. :)

    I used the DrawCanvas example, made a Sprite with a picture, put it on a layer, and "on layout start" I made the sprite "Destination atop", and paste the layer into canvas. Everything works fine.

    But if I choose "Fullscreen in browser" in "Scale" or "Letterbox Scale" mode the pencil and the brush works, but not the bucket. Did I miss something?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey R0j0 , did you make some effect example I can study , I really want to learn this awesome plugin , If you could make me a little trail that gets smaller after time example , I would be delighted :D

  • Thank you for the good job doing that Plug-In!!

    Let me see, if I could ask you that: Is it possible with your Plug-In to draw a shape, which could be animated to morph to another shape?! E.g. initial rectangle to become a hexagon??

  • XManBG

    It's possible. There are a few examples in this topic on how to draw shapes. Animation can be done by drawing one shape, clearing and drawing another.

  • You are right, thanks. It is possible to animate morphing shapes by drawing and clearing in a row.

    I've noticed, that there is no functionality regarding Canvas Origin and additional Image Points. The appropriate button is gray. Speaking of shapes, there could be always the need to create procedural some "sticky" points on that shape, to Pin (behavior) other objects on them... Do you think it could be implemented?? Or maybe there is a way right now, but I still don't know how to use it?!

  • XManBG@

    Here's a simple example of an editable shape using the 'canvas' plug -

    <img src="https://dl.dropbox.com/u/22173473/POLY1.jpg" border="0">

    TEST

    CAPX

    Hope this helps.

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