raphael

moving custom font doesn't work

蹲街弑〆低调 提交于 2020-01-03 02:58:27
问题 I'm trying to move a text via animation using raphael's print(), but it doesn't work: var paper = Raphael(document.getElementById("stage"), 640, 480); var text = paper.print(300, 200, "Test Text", paper.getFont("Yanone"), 50); text.animate({ y: 400 }, 1000); Anyone have ideas what I may be missing? 回答1: I think you should use the text function instead of the print function if you want to animate it later. I'm not sure why but it works ... Here is an example with both ways of doing it: var

Raphaeljs support in IE8

梦想与她 提交于 2020-01-02 12:24:12
问题 I am creating a dynamic visualization using Raphael-js. I started off with using Raphael-1.5.0 and things seemed to work okay. http://www.iiserpune.ac.in/~coee/histome/variants.php?variant=Histone_H3.1 In particular, the PTMs (little letters on top of large letters) are hyperlinked to their individual pages. While this worked in Chrome, Firefox, and Safari, the hyperlinks were absent on IE8 (worked in IE9). When I upgraded to Raphal-2.0 In IE8 the figure disappeared completely. Is it an issue

How to allow to type text in raphael object, say rect?

风流意气都作罢 提交于 2020-01-02 12:02:50
问题 I have created a Raphael rect like below: var rect1 = paper.rect(100,100,100,100) Now, I want that as I click on the rect a cursor appears and user is allowed to type/key in some text I am very very new to JS and Raphael. 回答1: That's not a natural use of Raphael. Think of it primarily as a drawing library. If you look through the SVG specifications or any of the demos on the RaphaelJS page, you'll get the idea. But Raphael integrates naturally with native Javascript or jQuery. I would place a

How to allow to type text in raphael object, say rect?

巧了我就是萌 提交于 2020-01-02 12:01:37
问题 I have created a Raphael rect like below: var rect1 = paper.rect(100,100,100,100) Now, I want that as I click on the rect a cursor appears and user is allowed to type/key in some text I am very very new to JS and Raphael. 回答1: That's not a natural use of Raphael. Think of it primarily as a drawing library. If you look through the SVG specifications or any of the demos on the RaphaelJS page, you'll get the idea. But Raphael integrates naturally with native Javascript or jQuery. I would place a

Word Wrap in Raphael JS / SVG

。_饼干妹妹 提交于 2020-01-02 04:16:16
问题 How do you get words to wrap inside a box in RaphaelJS? Or in browser-based SVG in general? I found this thread on it, but it doesn't make any sense. They say to use "widthToCharNum" but as far as I can tell, this thread is the only place those words have ever been used on the internet. They suggest using a "width" attribute, but this has no effect. 回答1: Text-wrapping is not built into Raphael or the SVG spec. Period. Coming from the HTML world, I found the absence of text wrapping pretty

Changing text in RaphaelJS

孤者浪人 提交于 2020-01-02 01:14:06
问题 How may I change the text in a RaphaelJS-created text node? First, I am creating a new element with a text string with Raphael, and at some later point I would like to change this text. It's easier for me if I do not have to reinitialize the element as there will be a whole host of attributes attached that will be a pain to recreate. Is there a way to do this? I've got my logic below, but it doesn't work; it's there just to provide extra insight as to what I'm trying to achieve. Thanks var R

Building a Raphael path object in piecemeal fashion

自古美人都是妖i 提交于 2020-01-01 19:38:53
问题 I'm trying to create a little free-hand drawing app, and to figure out a way to add path segments (e.g. "L10,10") to a Raphael path Element. This answer suggests that isn't possible. I've tried doing something like: var e = paper.path("M0,0L100,100") e.attr("path").push(["L",50,100]) ...which does alter the array returned by e.attr("path") but doesn't change the graphic, so I guess this isn't supported behavior. 回答1: It looks like you have to call the setter version of .attr() to update the

Update pie slice size in Raphael pie chart

99封情书 提交于 2020-01-01 12:10:52
问题 I'm working on making a pie chart that shows results over time. As such it needs to animate between states to show how different slices change. I've figured out how to change all the slices en masse (using this example as a starting point), but I would like to be able to select and manage a particular slice (or sector as Raphael calls it) at a time. Has anyone figured out how to do that? I've found that if var pie is my pie chart, then I can get a particular slice with: var pie = r.g.piechart

How do I rotate a div with Raphael.js?

只谈情不闲聊 提交于 2020-01-01 05:41:05
问题 I am brand new to Raphael and am really stuck, I would like to rotate a div and its contents, using a button, with Raphael. Ideally, I would like to have a smooth animation that goes from 0 degrees to -90 degrees when the button is clicked, then when the button is clicked again, the animation would reverse. I think I will change the id or class on mouse click so that I can use the same button for both animations. Would that be wise? I really would like some help please, my Sandbox is at http:

Raphael canvas(background) onclick event

那年仲夏 提交于 2020-01-01 01:30:09
问题 I have been working with Raphael to create drag and drop shapes on a canvas. I do this using the .drag() function (supplied in the Raphael framework) along with my event functions. I have no issues doing this. I also have a function that creates a new shape onDblClick, the problem is, I can only attach the event to a shapes, or other elements I create. Adding events to a shape works like so: R = Raphael("canvas", "100%", "100%"), R.rect(100, 100, 25, 50).attr({fill: fillColor}).dblclick