raphael

How to determine size of Raphael object after scaling & rotating it?

情到浓时终转凉″ 提交于 2019-11-26 18:30:13
问题 If I were to create an image as a Raphael.js object with the initial size [w1,h1] , then scale it using the transform() method, how would I afterward retrieve its new size [w2,h2] ? Because calling image.attr("width") returns w1, the initial width, not the width after the transformation. I know you might say that I should simply multiply w1 and h1 with the scaling factors, but most of the times, a rotation transformation is also applied, which makes things a little more cumbersome. So in

Draggables and Resizables in SVG

此生再无相见时 提交于 2019-11-26 17:58:26
问题 I want to make an svg element (path, rect, or circle) be able to be draggable and give it resize handles. But unlike HTML DOM, not all elements have an upper left hand corner x,y coordinate and a width and height for a box surrounding the content. This makes it inconvenient to make a generic resize or drag procedure. Is it a good idea to have each path or circle be drawn inside its own svg object to give me a box to play with? How is draggable/resizable typically implemented in SVG? 回答1: Note

How can I combine objects in the Raphael javascript library?

心已入冬 提交于 2019-11-26 15:14:29
问题 Sorry for a long question but here goes. I am trying to modify the drag shapes around demo here: http://raphaeljs.com/graffle.html The demo works fine. What I want to do is put words inside the shapes and move the shape and text around as a composite single object. Here is the code for creating the objects: window.onload = function () { var dragger = function () { this.ox = this.type == "rect" ? this.attr("x") : this.attr("cx"); this.oy = this.type == "rect" ? this.attr("y") : this.attr("cy")

How to write a web-based music visualizer?

断了今生、忘了曾经 提交于 2019-11-26 12:29:11
问题 I\'m trying to find the best approach to build a music visualizer to run in a browser over the web. Unity is an option, but I\'ll need to build a custom audio import/analysis plugin to get the end user\'s sound output. Quartz does what I need but only runs on Mac/Safari. WebGL seems not ready. Raphael is mainly 2D, and there\'s still the issue of getting the user\'s sound... any ideas? Has anyone done this before? 回答1: By WebGL being "not ready", I'm assuming that you're referring to the

jQuery SVG vs. Raphael [closed]

China☆狼群 提交于 2019-11-26 11:44:09
问题 I\'m working on an interactive interface using SVG and JavaScript/jQuery, and I\'m trying to decide between Raphael and jQuery SVG. I\'d like to know What the trade-offs are between the two Where the development momentum seems to be. I don\'t need the VML/IE support in Raphael, or the plotting abilities of jQuery SVG. I\'m primarily interested in the most elegant way to create, animate, and manipulate individual items on an SVG canvas. 回答1: I've recently used both Raphael and jQuery SVG - and

SVG re-ordering z-index (Raphael optional)

大城市里の小女人 提交于 2019-11-26 08:56:02
问题 How can I reorder Raphael or their underlying SVG elements after creation. Better yet, do something like layers exist in SVG? Ideally I would like two or more layers in which to place elements at any time; A background and a foreground layer. If that is not an option, popping elements to the front would be ok, and pushing it to the back would be better in this particular case. Thanks, 回答1: Gimme the Code! // move element "on top of" all others within the same grouping el.parentNode

How to access SVG elements with Javascript

偶尔善良 提交于 2019-11-26 00:15:36
问题 I\'m messing around with SVG and I was hoping I could create SVG files in Illustrator and access elements with Javascript. Here\'s the SVG file Illustrator kicks out (It also seems to add a load of junk to the beginning of the file that I\'ve removed) <?xml version=\"1.0\" encoding=\"utf-8\"?> <!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"> <svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www