How to use the raphael.getTotalLength function in raphael

To help you get started, we’ve selected a few raphael examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kaniwani / kw-frontend / app / common / components / KanjiStroke / dmak-0-3-1.js View on Github external
function preprocessStrokes(data, options) {
  const strokes = [];
  let stroke;
  let length;

  for (let i = 0; i < data.length; i += 1) {
    for (let j = 0; j < data[i].length; j += 1) {
      length = Raphael.getTotalLength(data[i][j].path);
      stroke = {
        char: i,
        length,
        duration: length * options.step * 1000,
        path: data[i][j].path,
        groups: data[i][j].groups,
        text: data[i][j].text,
        object: {
          path: null,
          text: null,
        },
      };
      strokes.push(stroke);
    }
  }