Note that there are some explanatory texts on larger screens.

plurals
  1. POPaths and subpath don't manage the arc curve the same way
    primarykey
    data
    text
    <p>I'm having issue with generating arc curves with Raphael.</p> <p>I created a reduced example here: <a href="http://jsfiddle.net/vaxilart/m6cHw/3/" rel="nofollow">http://jsfiddle.net/vaxilart/m6cHw/3/</a></p> <p>As you can see, the first path drawn isn't the same as the second one, and the second one is only a subpath of the first.</p> <p>Do you know why both are different? And how could I resolve this issue?</p> <p>Here's the code:</p> <pre><code>function drawpath( canvas, bg, pathstr, duration, attr, callback ) { var guide_path = bg; var path = canvas.path( guide_path.getSubpath( 0, 1 ) ).attr( attr ); var total_length = guide_path.getTotalLength( guide_path ); var last_point = guide_path.getPointAtLength( 0 ); var start_time = new Date().getTime(); var interval_length = 50; var result = path; var run = function run() { var elapsed_time = new Date().getTime() - start_time; var this_length = elapsed_time / duration * total_length; var subpathstr = guide_path.getSubpath( 0, this_length ); path.attr({ path: subpathstr }); if ( elapsed_time &gt;= duration ) { if ( callback != undefined ) callback(); } else { requestAnimationFrame(run); } }; run(); return result; } var sequence_path = [ [ "M", 200, 0 ], [ "V", 200 ], [ "A", 100, 100, 90, 0, 0, 300, 300 ], [ "H", 400 ], [ "A", 100, -100, 90, 0, 0, 500, 400 ], [ "V", 500 ], [ "A", 100, -100, 90, 0, 0, 400, 600 ], [ "H", 200 ], [ "A", 100, 100, 90, 0, 0, 100, 700 ], [ "V", 800 ] ]; var paper = Raphael(10, 50, 700, 1000); var bg = paper.path(sequence_path).attr({ stroke: 'white', 'stroke-width': 64, 'stroke-opacity': 1, fill: 'none', 'fill-opacity': 0 }); drawpath( paper, bg, sequence_path, 3500, { stroke: 'orange', 'stroke-width': 64, 'stroke-opacity': 1, fill: 'none', 'fill-opacity': 0 }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload