raphael

How to rotate an object back and forth around a specific point?

∥☆過路亽.° 提交于 2019-12-07 04:20:47
问题 I'm using Raphael JS in an attempt to rotate an image shape around a point which is below its center point. How can this be done? I have tried the following but it doesn't work. var playBBox = playButtonRef.getBBox(); var xPos = playBBox.x + playBBox.width/2; var yPos = playBBox.y; var animObject = Raphael.animation({ transform: playButtonRef.attr("transform") + "R60," + (this.cx - 25) + "," + this.cy }, 3000);​ animObject = animObject.repeat(10); playButtonRef.animate(animObject); I'm also

animating paths with raphael

我是研究僧i 提交于 2019-12-07 02:02:04
问题 I'm still trying to figure out Raphael and am stuck with some basic animation. have a look here: http://jsfiddle.net/d7d3Z/ it's simple enough: two paths that animate into place. What I want though is for it to appear to 'draw' this like a single line, rather than both starting together. How can I order the animations? 回答1: You can call the second animation after the first one is over. window.onload = function() { var c= Raphael("canvas", 200, 200); var p = c.path("M140 100"); var r = c.path(

Pushing D3.js output through fabric.js for IE8 support?

这一生的挚爱 提交于 2019-12-07 01:52:00
问题 I'm evaluating Fabric.js as an alternative to Raphael.js for creating interactive visualisations that are compatible with IE8, which doesn't support SVG or canvas (IE8 support is non-negotiable unfortunately). Raphael can be made to work with the visualisation library D3.js - which outputs SVG and is incompatible with IE8 - via the bridging library D34Raphael, a fork of D3 adapted for use with Raphael. D34Raphael adapts some (but not all) D3 features to output into Raphael's abstracted

Problem saving as png a SVG generated by Raphael JS in a canvas

孤街浪徒 提交于 2019-12-06 22:20:47
问题 I'm trying to convert a SVG generated by Raphael JS (and the user, since you can drag and rotate the images). I followed this Convert SVG to image (JPEG, PNG, etc.) in the browser but still can't get it. It must be easy but I can't put my finger on what I get wrong. I got my svg in a div with #ec as id and the canvas's one is #canvas . function saveDaPicture(){ var img = document.getElementById('canvas').toDataURL("image/png"); $('body').append('<img src="'+img+'"/>'); } $('#save').click

Raphael js, how to get a circle's center x, y position?

时光怂恿深爱的人放手 提交于 2019-12-06 16:05:27
If I have a circle object var c = paper.circle(...) I would like to get this circle's center x, y position, how to get? You can get the SVG attributes of cx and cy with: c.attr('cx'); Do something like: var c = paper.circle(...); var centerX = c.attr('x') + c.attr('width') / 2; var centerY = c.attr('y') + c.attr('height') / 2; 来源: https://stackoverflow.com/questions/5618794/raphael-js-how-to-get-a-circles-center-x-y-position

moving custom font doesn't work

≡放荡痞女 提交于 2019-12-06 15:10:32
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? 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 paper = Raphael("canvas", 640, 480); var fonts = [0, paper.getFont("DIN")]; //using print var p = paper.print

Raphaeljs support in IE8

不问归期 提交于 2019-12-06 14:17:32
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 with Raphael or the browser and any way to get around this? Simeon As you may or may not know, Raphaël

Get JSON data with AJAX and then modify raphael.js script

五迷三道 提交于 2019-12-06 13:27:04
This is what I want to achieve: I want to create an interactive map using raphael.js. Using Php, I get datas from MySql DB and converted into a JSON file. So far so good. Inside my raphael js file, I must now: get those datas use them in order to modify my raphael file. I am currently stuck at this first step. Here's my simplified JSON file (let's call it countries.json) : [ { "id": "1", "type": "Country", "title": "France", "published": "1", "description": "Republic" }, { "id": "2", "type": "Country", "title": "Belgium", "published": "0", "description": "Monarchy" } ] Here comes the

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

风流意气都作罢 提交于 2019-12-06 13:24:54
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. 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 borderless textarea on top of your rectangle and activate (and focus) it when the user clicks on the space,

Raphael JS : mouseover/mouseout - problem with text-labels

ⅰ亾dé卋堺 提交于 2019-12-06 12:19:41
I use Raphael JS to create an SVG-map with area's and textlabels. I want the area to highlight when you move the mouse over it. I have this working now, but when I move the mouse over the label (in the center of the area) the mouseout-event for that area is triggered, so the area is unhighlighted again. Is there any way to prevent this from happening, or a workaround ? Create a rect with opacity set to 0 over the text and attach the event handlers on that rect. You can calculate the dimensions of the rect using getBBox() of the text. Creating a set via Paper#set was the approach that worked