How can I achieve this effect using SVG and JS? [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I've already built the animation part, used JS to control the in SVG element.
Now what I want to achieve is something like this:
I tried to use paths.getBoundingClientRect() to get the distance between viewport's border to the path's highest position, so I can make the whole background change when the peak reaches a certain position. (if (rect.top <= 100) {...})
But I don't know how to control irregularly shaped areas' attributes.
Any possible solution?
Thank you very much.

i have used http://d3js.org for that sort of thing. it is very good. It provides a simple library to help you draw the graphs you want using svg. I think the particular part you are looking for is called library.
This is the API call.
https://github.com/mbostock/d3/wiki/SVG-Shapes#area
Some links below to examples and code for using d3js
http://bl.ocks.org/mbostock/3894205
http://bl.ocks.org/mbostock/3883195
http://mbostock.github.io/d3/talk/20111018/area-gradient.html
http://bl.ocks.org/NPashaP/113f7fea0751fa1513e1
http://bl.ocks.org/mbostock/1667367

Related

Random image generation? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm looking to create a Conway's Game of Life-type dynamic image that cycles through these general patterns (below).
Is it possible to create these types with Javascript? Or am I better off looking to a 3D application and cycling through an array of pre-define images?
Looking at your examples, I believe you could easily write Javascript code to generate these images. Personally, I would look to generating an SVG. You can do that without a library, but you may find a library like SVG.js helpful to play with.
I would look at the images as a 3x3 grid of your circles that you effectively randomly turn on or off (according to your desired logic). Then you could easily generate the "connector" lines between them.
After you have your 3x3 grid looking how you want it, you could apply a 45° rotation to the group and you are done.
With the above complete, you could then get the svg content and submit it to a server, save it to a file, etc.
If you have any experience with svg / js, you will likely be able to get this done very quickly.
Good luck to you!

Create Buttons from image in HTML [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I've got this interesting challenge here that I don't know how to solve. I'm trying to create HTML buttons from an Image. This image here is the example I am using. How can I split up all the trapezoids into separate buttons that register separately when tapped on the corresponding regions. I would assume I need to specify some kind of boundary for each trapezoid but I don't know how you would do that for a decently complex shape like this.
Use the HTML <map> element to create an image map from the image. Image maps allow you to map out shapes (circles, rectangles and irregular polygonal) from coordinates you provide and these shapes become clickable with their own hrefs. You are also able to get the x,y coordinates during the click event.
There are a variety of free tools on the Internet to generate the coordinates and the overall code.

Drawing an image in html5 using javascript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
i currently want to implement a draw image tool to my projects(something like the brush tool but instead of a color i am actually drawing with the picture). I want to be able to "draw" a picture by hovering my mouse over it. I m currently thinking about two possibilities, one is with a mask over the picture and actually erasing the mask with the mouse or the other posibility to try to draw with the canvas, making the zones touched by the mouse visible.
Do you have some general ideas about how should i start my work?
Thanks
I would prefer the canvas approach.
Here is another great tutorial:
https://code.tutsplus.com/tutorials/how-to-create-a-web-based-drawing-application-using-canvas--net-14288

Make whole page draggable [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am not sure where to start with this or even what keywords to search for, so I am asking for someone to point me in the right direction. Here is what I am wanting.
I am wanting to make a webpage that can be dragged in all directions with different HTML elements in all directions and load new elements as you get close to the edges via AJAX. I am hoping to achieve this via Bootstrap or JQuery.
Any ideas on how to get the page draggable like that?
jQuery UI has a draggable method that would work for you, as long as you target the viewable area as the element to initiallize the plugin on. If you prefer a more lightweight approach you can use this plugin created by Chris Coyier.: https://css-tricks.com/snippets/jquery/draggable-without-jquery-ui/.
An example of it working in just 2 directions would be found in this SO thread as well: Scroll the page on drag with jQuery however the actual plugin being used in the demo supports all direction dragging - see the authors site: http://davetayls.me/jquery.kinetic/

How to build a graph page like this one? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I came accoss this webpage: http://www.concerthotels.com/100-years-of-rock and it is very cool. I would like to build some content with similar looking.
Is it possible that someone could give me a direction how this page is built? Thanks a lot for that.
this is made with javascript , css , html5
there are many jquery plugin like scroll magic who can give you the same effect as scrolling content automatically or made you own timeline : (http://janpaepke.github.io/ScrollMagic/)
also drawing and animating lines can made with SVG (Scalable Vector Graphics ), visit for more information (http://www.w3schools.com/svg/) .
hope this can give you a small view of how you can do the same effect :)

Categories

Resources