raphael

What is a “matrix” for in raphael

一笑奈何 提交于 2019-12-18 03:06:18
问题 I'm trying to get a better understanding of raphael.js in general, but i've found that the raphael.js documentation can be confusing at times and at other times a bit vague. can anyone explain to me what matrix is for and how it is used? 回答1: There's almost no good, clear information on Matrix in Raphael anywhere. However, the good news is, it's almost exactly the same as Matrix transformations in SVG and also CSS3. There are some guides to matrix transforms in SVG, but they usually assume

SVG animation along path with Raphael

落爺英雄遲暮 提交于 2019-12-18 02:46:49
问题 I have a rather interesting issue with SVG animation. I am animating along a circular path using Raphael obj = canvas.circle(x, y, size); path = canvas.circlePath(x, y, radius); path = canvas.path(path); //generate path from path value string obj.animateAlong(path, rate, false); The circlePath method is one I have created myself to generate the circle path in SVG path notation: Raphael.fn.circlePath = function(x , y, r) { var s = "M" + x + "," + (y-r) + "A"+r+","+r+",0,1,1,"+(x-0.1)+","+(y-r)

How to get the outline of a stroke? [duplicate]

大城市里の小女人 提交于 2019-12-17 19:36:32
问题 This question already has answers here : svg: generate 'outline path' (3 answers) Closed 2 years ago . I want to convert a stroked path to a filled object. (Programmatically, in JavaScript.) The line is just a simple curved line, a sequence of coordinates. I can render this line as a path, and give it a stroke of a certain thickness... but I'm trying to get a filled shape rather than a stroked line, so that I can do further modifications on it, such as warping it, so the resulting 'stroke'

Drag, drop and shape rotation with Raphael JS

℡╲_俬逩灬. 提交于 2019-12-17 17:54:10
问题 I'm using RaphaelJS 2.0 to create several shapes in a div. Each shape needs to be able to be dragged and dropped within the bounds of the div, independently. Upon double clicking a shape, that shape needs to rotate 90 degrees. It may then be dragged and dropped and rotated again. I've loaded some code onto fiddler: http://jsfiddle.net/QRZMS/. It's basically this: window.onload = function () { var angle = 0; var R = Raphael("paper", "100%", "100%"), shape1 = R.rect(100, 100, 100, 50).attr({

drawing centered arcs in raphael js

纵然是瞬间 提交于 2019-12-17 15:17:33
问题 I need to draw concentric arcs of various sizes using raphael.js. I tried to understand the code behind http://raphaeljs.com/polar-clock.html, which is very similar to what I want, but, whithout comments, it is quite difficult to fathom. Ideally, I would need a function that creates a path that is at a given distance from some center point, starts at some angle and ends at some other angle. 回答1: That answer is ok, but cant be animated. I ripped the important stuff out of polar-clock for you.

how to give dragging limitation to svg elements in Parent Div That means for Ex. the while dragging ellipse & rect elements didn't go outside the box

ⅰ亾dé卋堺 提交于 2019-12-14 03:59:38
问题 How to give dragging limitation to svg elements in Parent Div That means for Ex. the while dragging ellipse & rect elements donot go outside the box See The Example => Example Scenerio Click here 回答1: I have done with the limitation of SVG elements( Rect and Ellipse) but while dragging Text goes outside the the border of parent Div see the Example see the Example => Click Here 来源: https://stackoverflow.com/questions/29559043/how-to-give-dragging-limitation-to-svg-elements-in-parent-div-that

JavaScript not working as expected

六眼飞鱼酱① 提交于 2019-12-14 03:26:52
问题 I want to draw chart that is beautiful in my VC++ program and so decided to implement in by HTML and JavaScript. As it show, I downloaded a Javascript lib and used it as it said in its site. How to use it? Download and include raphael.js into your HTML page, then use it as simple as: // Creates canvas 320 × 200 at 10, 50 var paper = Raphael(10, 50, 320, 200); // Creates circle at x = 50, y = 40, with radius 10 var circle = paper.circle(50, 40, 10); // Sets the fill attribute of the circle to

How do you make an element undragable in Raphael?

柔情痞子 提交于 2019-12-14 01:33:52
问题 I made an element dragable using element.drag(start, move, up); When I want to make the element undragable, I can somewhat achieve this using the method from the documentation : element.undrag(f); // Any undefined variable works as the argument This makes it so that the element cannot be moved anymore. This method has 2 problems: This makes all elements on the page undragable. start() still fires once for each element. I have an opacity change triggered in start() so it's quite obvious. How

raphael js, resize canvas then setViewBox to show all elements

余生颓废 提交于 2019-12-13 17:31:42
问题 I have a problem with my canvas. My canvas in first width = 1300, height = 500 Then I resize it to width = 800px, height = 500 I try setViewBox to zoom it. But mouse not fix with element when I drag them. @canvas.resize(800, 500) @canvas.setViewBox(0,0, ??, ??) how to calculate it??? Thank for your help. :) 回答1: You can calculate the necessary dimensions using an approach like this: function recalculateViewBox( canvas ) { var max_x = 0, max_y = 0; canvas.forEach( function( el ) { var box = el

Responsive SVG line graph with Raphaël

时光总嘲笑我的痴心妄想 提交于 2019-12-13 17:03:13
问题 I'm looking at graphing solutions for my responsive webapp. I really like this Raphaël analytics demo: http://raphaeljs.com/analytics.html (Here it is on JS Bin: http://jsbin.com/svg/1/edit) ...but it's not responsive. I found this responsive SVG graph on codepen: http://codepen.io/meloncholy/pen/KxiJA, but I'm looking for a JavaScript integrated solution like Raphaël, not just a static SVG. Any way to combine the two so as to make the Raphaël graph responsive? Here's an article by the