How to draw a line linking two elements on HTML page? [duplicate] - html

This question already has answers here:
Drawing arrows on an HTML page to visualize semantic links between textual spans
(10 answers)
Closed 9 years ago.
I want to draw a line on HTML web page dynamically to connect two html elements, which can move on html page.
This action is something like connect two Rectangle's angle, like this:
Is there any way to achieve this?

You may want to look at this tutorial. This tutorial teach you how to draw lines by HTML Canvas API.
HTML5 Canvas Line Tutorial
To draw a line using HTML5 Canvas, we can use the beginPath(),
moveTo(), lineTo(), and stroke() methods.
First, we can use the beginPath() method to declare that we are about
to draw a new path. Next, we can use the moveTo() method to position
the context point (i.e. drawing cursor), and then use the lineTo()
method to draw a straight line from the starting position to a new
position. Finally, to make the line visible, we can apply a stroke to
the line using stroke(). Unless otherwise specified, the stroke color
is defaulted to black.
http://www.html5canvastutorials.com/tutorials/html5-canvas-lines/

You could use the HTML5 canvas but you will have to be more specific with your question so we can help you further.

Related

is anyone solve about saving filtered canvas as an image? [duplicate]

This question already has answers here:
How to save image from canvas with CSS filters
(4 answers)
Closed 7 years ago.
Really sorry if my question is a duplicate one.
based on this problem Capture/save/export an image with CSS filter effects applied
and from that link was asked before, still no idea to solve the problem. because Im using many filter effect in a canvas (like hueRotate, brightness, sepia, blur, contrast, etc).
is anyone know how to save an image with css filter applied?
the key from this problem is how to putImageData from filter layer into canvas.
I've tried many times and it come with no filter applied.
I've also searching from any website and books, still have no idea to solve this.
so, is anyone solve this problem?
(sorry for my bad english, this problem is my final task, so I will really appreciate if you guys can help me.)
There's a fairly easy solution.
You need to change the canvas pixels to reflect your desired filter and then save the canvas as an image.
Draw the original image on the canvas with drawImage. Be sure you satisify cross-domain security restrictions, otherwise the canvas will be tainted and you will not be able to use the canvas methods required to apply the filter.
Fetch the RGBA pixel data for all pixels on the canvas using getImageData.
Apply your desired filter by modifying the canvas pixel data from step#2. Here's a relevant previous Stackoverflow Q&A: HTML5 Canvas blending & IE / Edge
Put the filter-modified pixels back onto the canvas using putImageData.
Convert the canvas to an image using toDataURL. Note: Chrome and Foxfire allow the user to directly save the canvas as an image with right-click-save-as-image on their canvas context menu.

How would you divide the html5 canvas into multiple areas to hide/show only parts

I have a canvas where I manually create rectangles to build a full individual chart diagramm. Doing some coloring and text placing etc...
How can I easily tell a certain area to hide itself and show again?
Can there be a object orient approach to divide the canvas somehow in areas?
I don't think that there is a solution that works the way you want. Canvas element don't keep track of areas are elements like you know it from the dom. There are some things you can do:
Think about using svg. SVG works more like html and can be manipulated via javascript/dom and css.
Redraw the whole canvas with the elements you want to display. You don't have to do this manually. Some framework like paper.js or kinetic.js will help. These framework also have feature like layers.
The canvas element has the api functions getImageData and putImageData. With these functions you can save an area of the canvas into a javascript array and blank the area using the canvas drawing functions. When needed, you can redraw the area with the putImageData function.

Can we add the Word Art style in flex

Can we add the WORD ART or WARP TEXT style in flex
etc
Just like these images i want to make test like bottom arcs, vertical arcs, Birdseye etc as as shown in the images above.
Please help me is that possible in Flex to make such text fonts styles
you can do an envelope distort
envelope-distort-with-actionscript (download source)
First you will draw your textfield to a bitmap using the myBitmap.draw(myTextField). Then you will use the code below to distort that bitmap.
You can either let the user control it or you could set the handles visible to false and set their x,y to preset positions to achieve different effects.
Are you building a tshirt design tool? I created one of those years ago and had effects like this.
I have found a link where we can obtain the word art style in flash which will be very useful for all click here

How to draw a curved, dashed arrow with HTML5 and animate it

My goal is to create a curved arrow like this one, on an html5 canvas:
I have found several resources on how to draw lines but none of them seem to work. I also found a related stackoverflow post.
Also, is it possible to animate it on hover in order to expand the arrow, using an elastic effect maybe?
Raphael and canvas both have some limitations when it comes to drawing lines in a pen-on-paper style. I've found the best way to simulate such a thing is to iteratively transform a 1-pixel path into a target path, as in this fiddle: http://jsfiddle.net/zPRha/31/ With a little work, you could calculate the angle between the last two points along the path and transform/rotate an arrow path to match the line as it is drawn. It's not an ideal solution, but it would work.
Raphael's built in hover support makes zooming/unzooming extremely easy. My understand is that such handling would be rather more obtuse using canvas natively, though I'm sure some canvas libraries have automated away this concern.
Here is an updated fiddle with optional support for an arrow: http://jsfiddle.net/kevindivdbyzero/JPqXF/
I think you should use SVG with CSS3 transitions to do this kind of stuff.

Custom shape and fill in HTML5 canvas

I have a small project I am working on HTML5 canvas and I wanted to get some ideas how to accomplish it. I have built an outline of a tree using all the canvas line functions. lineTo, bezierCurveTo, quadracticCurve, etc. I have attached a picture of the outline. Now, what I would like to do is have some code that fills a percent of this outline. Kind of like a progress bar starting from the bottom. Does anyone have ideas on how to accomplish this?
Thanks
Rather than thinking of the problem as having to fill a percentage of the inside of the tree, why not split the image into two layers, the tree and the "fill", and then draw one over the other. See my image below for a quick and dirty example.
Of course, you will need to obscure the rest of the "fill" layer, so you will need to fill the outside of the tree shape white, but this should be fairly easy as you already have the path worked out. In essence, your path would instead of being the outside edge of a a tree shape, become the inside edge of a tree shaped hole!