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

290
Vistas
Paper.js - Rotate segment points around a radius size

I have an imported SVG in my paper.js project.

What i'm trying to do is to rotate each of the svg's segment points around a set radius, animating it with the onFrame() method.

I know how to position each segments point's x and y position but i cant really figure out how to position it in a 'rotation'.

What i have now :

enter image description here

var words = project.importSVG(document.querySelector("svg"));
words.visible = true; // Turn off the effect of display:none;;
words.position = view.center;

var letterR = words.children.letter_r;
var letterR_outside = letterR.children.letter_r_outside;
letterR_outside.selected = true;


var rotate_point = view.center;

function onFrame(event) {

  var _delta = Math.sin(event.time);

  //   console.log(Math.round(50 * Math.cos(theta[0])) * _delta);
  //   letterR_outside.segments[0].point.x = Math.round(_radius * Math.cos(theta[0]));
  //   letterR_outside.segments[0].point.y = Math.round(_radius * Math.sin(theta[0]));


  for (var i = 0; i < letterR_outside.segments.length; i++) {
    var segment = letterR_outside.segments[i];
    // segment.point.x += _delta;
    segment.point.rotate(3, rotate_point);
  }

}

Example of what i'm trying to achieve by rotating each points around a radius. [i made the black circles visible to show the rotation circle of each points] enter image description here

I'm not exactly sure how to approach this. Any help is greatly appreciated

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

0

Calling the point.rotate() does nothing because it returns a clone of the point and doesn't modify it directly.
See the documentation:

Rotates the point by the given angle around an optional center point. The object itself is not modified. ...

So you might want to reasign the value:

segment.point = segment.point.rotate(3, rotate_point);
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