How do I get this smooth drawing in any speed of cursor?

Get help using Construct 2

Post » Wed Aug 26, 2015 4:11 am

Hi,

Please see this http://www.cs.vu.nl/~eliens/media/mobil ... urveTo.htm

This is a canvas based drawing. I see we also have canvas plugin. But can we achieve this kind of smooth drawing even if we move cursor fast?

Try to draw fast and you will still see the smoothness in the drawing.

Thank you,
Last edited by vijayrajesh on Wed Aug 26, 2015 1:53 pm, edited 1 time in total.
B
9
S
2
Posts: 59
Reputation: 763

Post » Wed Aug 26, 2015 5:57 am

@vijayrajesh

well, I am sure that level of smoothness could be matched with some effort... The name of it (CurveTo) implies that it is calculating curves between mouse positions. My example below just draws from position to position, so it is not as smooth.

This paint program was started by my son - he wanted to make a game where you draw your own weapon. I cut out the weapon parts (he had templates to trace and standard parts you could drop in, and then let you try it out).

I made it draw in a random color, and added a small random amount to the line thickness to help smooth out the line a little.

Use the scroll wheel to increase or decrease the pen thickness. The right mouse button erases, the left draws.
(This requires ROJOhounds Canvas plugin).

http://www.rieperts.com/games/forum/CanvasPainter.capx
B
94
S
33
G
20
Posts: 438
Reputation: 17,615

Post » Wed Aug 26, 2015 11:50 am

@AllanR Thanks for your generosity in sharing such a wonderful source.

Yes, It is smoother. And I have to honestly say, I can see sharp deviations when we draw faster. May be to make a good drawing program for kids, it is very useful indeed.

BTW, does it work on touch devices too? Or should i change the code?
B
9
S
2
Posts: 59
Reputation: 763

Post » Wed Aug 26, 2015 3:42 pm

@vijayrajesh that example does not use Touch, mouse only. Touch gets a little tricky because there is no Left and Right button or middle Scroll Wheel. I was working on a multi touch interface last month, and would want to track each touch point to make a proper touch paint program...

but for now I quickly adapted the capx above for touch. You can't change the size of the brush. The second touch point becomes an eraser... It wouldn't be hard to make a proper tool palette to change brush size, color, etc.

http://www.rieperts.com/games/forum/CanvasPainterTouch.capx

The Canvas plugin does have various ways to draw curves - so getting smoother lines would be possible.
B
94
S
33
G
20
Posts: 438
Reputation: 17,615

Post » Wed Aug 26, 2015 3:49 pm

Once again thanks @AllanR
B
9
S
2
Posts: 59
Reputation: 763


Return to How do I....?

Who is online

Users browsing this forum: SputnikCZ and 3 guests