Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

299
Vistas
How to loop the edge animation to marching ant in cytoscape.js

How do I make the edge animate like in marching ant and point it towards the target node?

I tried using the line-dash-offset property like this but it doesn't loop.

style

{
      selector: "edge",
      style: {
        "curve-style": "taxi",
        width: 2,
        "target-arrow-shape": "triangle",
        "target-arrow-color": "#9dbaea",
        "line-style": "dashed",
        "line-dash-pattern": [8, 4],
      }
    }

animation

let loopAnimation = eles => {
  eles.animation(
      {
        style: {
          "line-dash-offset": 24,
          "line-dash-pattern": [8, 4],
        }
      },
      {
        duration: 1000
      }
  ).play().promise('complete').then(() => loopAnimation(eles))
};

cy.edges().forEach(loopAnimation);

diagram

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I was able to resolve this by calling reverse() before you play it

let loopAnimation = eles => {
  const ani = eles.animation(
      {
        style: {
          "line-dash-offset": 24,
          "line-dash-pattern": [8, 4],
        }
      },
      {
        duration: 1000
      }
  );

  ani.reverse().play().promise('complete').then(() => loopAnimation(eles))
};
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda