I want similar functionality for drawing image with smooth curves in html canvas. Can somebody tel me how to get such smooth curves?
I used Smooth.js for a projet and I was pretty convinced by it.
See some examples here.
Highly recommend one of the bests in this category:
http://paperjs.org/examples/path-simplification/
http://d3js.org/
Related
hey guys I need guidance to recreate a wonder full effect which I saw in a website
Fifty-five.com . After the pre-load is over you will see the company's logo in a canvas.
I have have been successful in creating the particle in a canvas but what math goes into linking the particles to create a mesh like structure on mouse over the canvas ?
I have found this http://cssdeck.com/labs/html5-canvas-particles-web-matrix Maybe you can add some mouse interactivity. Please show here the final result.
NOTE: I am not expert in this thing.
Have a look at particles.js:
http://vincentgarreau.com/particles.js/
https://github.com/VincentGarreau/particles.js/
Their home page has a similar effect to that used on the Fifty-five.com site you mention.
You can enable "line_linked" to link the particles.
I hope this helps.
I'm working on a paint application with canvas, and trying to make some better tools.
now i have one tool that only connects lines while following the mouse movement.
can you think of a good tutorial or a good idea for other tools like spary, or brush?
thanks
You might find the following resources useful:
Create a Drawing App with HTML5 Canvas and JavaScript
Create a Paint Bucket Tool in HTML5 and JavaScript
Overview of JavaScript Application Development - Case CanvasDraw
Presentation - Intro to HTML5 Canvas
Feel free to contact me if you need more specific pointers. I think those above should at least help you to get started. :)
Please have a look at this code project article.
it may be useful to you.
http://www.codeproject.com/Articles/427422/Paint-Brush-Application-Using-HTML5-Canvas
thanks
I don't have a tutorial, but I think you should simply use thicker lines to create a brush tool.
A spray tool could draw random points in a circle with random alpha(that's quite easy to implement), but that might be extremely slow on some browsers. Drawing using pre-generated images would be much better but harder to implement.
I am trying to generate some sun 'rays' which I can best describe as looking like the blade of a krisknife, such as the blade portion of this picture.
This is just an example. I only need a triangular shape with two or three waves that I can close and fill.
Better yet, is there some HTML5 app with which I can draw a complex figure and then export the javascript (moveTo, arcTo, bezierCurveTo, quadraticCurveTo, ...). Something similar to HTML5 Bezier Sketcher but which saves the javascript. Trying to draw complex figures blind is very difficult and I don't want to switch to SVG if it is not necessary.
Thanks 1,000,000
Edit: I have now also looked at all the options at this site. None will allow me to draw and fill simple curves and then see/save canvs commands. All that show commands show them in new libraries like fabric or jsDraw2D.
You can parse SVG into an html5 canvas with fabric.js.
That might do the trick for you.
https://github.com/kangax/fabric.js
Beside SVG it can help you with a nice API to canvas drawing.
I found the answer among the solutions for Convert SVG to Canvas friendly output. The author didn't think it worked for him, but I think it's as perfect as any I have seen.
Professor Cloud (...is frikkin' amazing! This isn't the first thing he's done I have found incredibly useful.) created a site to take SVG input and product Canvas output. You can see it here, at Professor Cloud SVG-to-Canvas.
Using this site, I can draw something or even take a stock vector image in AI, export as SVG, cut out the commands and past them into Prof. Clouds amazing SVG-chipper, and get Canvas code. I understand it doesn't support full SVG capabilities, but then, neither does Canvas. Great for me.
Your solution is probably best but just for the record, I tried experimenting with some graph plotting, and got some nice results:
The equations are:
sin(x)*log(2/x) + x/10
sin(x)*log(2/x) - x/10
You can plot them using: http://www.graphsketch.com/
It looks good with 0 < x < 25
I have searched the web and found no answer. I want to draw lines on an HTML5's canvas element but having a texture that is not solid, rather custom. Just like brushes in Photoshop if you know them. For example, to have a line that looks like it was drawn with chalk or artist paint brush. Do you know a way to do it?
Why don't you use croquis.js?
It has neat brush implementation like photoshop :)
And here is Demo which is using croquis.js.
Have you considered using libraries such as Processing.js or Fabric.js?
You can also take a look at this blog entry that might be interesting for you:
http://rhyolight.posterous.com/new-brushes-for-harmony-canvas-app
If you want to develop everything from scratch you should put a lot of effort into it!
Trying to draw a basic stick man in html 5 css that walks. If anyone has any sample code that achieves this or can point me to a tutorial that does I would be grateful. (please note I have seen the tutorials on drawing shapes)
Thanks in Advance
Sencha animator gives a GUI similar to Flash for animating in HTML5 with CSS3. Should make life a lot easier.