Can I rotate a drawing canvas?

0 favourites
  • 9 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • Hi all,

    I am creating a game where I rotate the layers. Fine for 2d gfx ..But when I use a drawing canvas for vector stuff this does not seem to rotate with the layer it is on or does not seem to be rotatable by itself either. Am I missing something? Repositioning each point around middle of layer might work but sounds cumbersome and maybe intensive as well.

    Thanks for your help!

  • You would transfer the Canvas to A Sprite via url.

  • Aha I see! I will have to compare performance though to rotating each point as it will involve complete full screen canvas to be printed into a sprite.

  • Aha I see! I will have to compare performance though to rotating each point as it will involve complete full screen canvas to be printed into a sprite.

    No idea what you are doing, but that doesn't sound like a good idea.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • can you rotate the layer instead?

    edit: I didb't fully read the first post...

    when you are drawing on the canvas, you might have to calculate the layer coordinates for the layer the canvas is on by using LayerToCanvas, and then CanvasToLayer

    but I haven't tried that...

    edit2: ok, just tried it and got funny results - so tried it in C2 and it seemed to work the way I would expect, so it might be a bug in C3.

  • Rotating a drawing canvas can definitely be useful. Please vote for this idea here:

    construct3.ideas.aha.io/ideas/C3-I-1050

  • You can try my rotate shader effect. It rotates the _image_ of the object within the object on C3 render (it does not the object itself.)

    It has a bunch of fun caveats :)

    - It requires 'spacing' in terms of making the DC or sprite large enough that when you rotate the images within the DC.

    - It requires the DC to be square (could probably fix this in the effect by taking pixelSize.x/pixelSize.y into account)

    - When pasting into DC, DC will be located in the original non-rotated position.

    Yes, this may make it too hard to use, but just in case you have a special case that can deal with the above caveats... I've tried it and I get the DC image to rotate.

    Of course, I support the idea to add the real function to rotate the DC also though!.

    construct.net/en/make-games/addons/313/rotate

  • What I am using it for is drawing vectors all over the screen and then I would like to rotate the whole layer them together with its counterparts if layers with sprites. So full screen is unavoidable and since the calculation is already complex for where they appear I figured rotating some 100 points around the middle might be faster than pushing a whole snapshot at 60 frames/second but I have not tested. That shader plugin might be interesting as well! Did not expect so many answers 😁 A built-in rotation no matter how it solves it internally would be hardier for coding.

    Yes I voted as well 👌

  • if you are just drawing vectors, have you tried using sprites for lines instead of a drawing canvas?

    here is a sample I was playing with a while ago to make bezier curves... I added lines and a button to start/stop rotation of the layer the lines are on. The end points for lines and the "fixed" two point bezier are containers so that the other parts are automatically selected if you start dragging them around.

    https://www.rieperts.com/games/forum/Bezier_Curves.capx

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