Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9116405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:39:53+00:00 2026-06-17T04:39:53+00:00

I am using Raphael.js to create a Play button icon. However, the triangle is

  • 0

I am using Raphael.js to create a “Play” button icon. However, the triangle is positioned too close to the edge of the circle. On mouseover, I am increasing the stroke width – the problem being that the triangle actually comes outside the circle, which is not what I want at all. The HTML is just a div with an id:

<html>
 <head>
 </head>
 <body>
  <div id="playB"></div>
 </body>
</html>

The javascript is rather long so here is the jsfiddle

What is the easiest way to “move” a path of an SVG in this case? i.e. – starting further from the right and further from the top. I have tried various things, but apart from changing the size of an icon – multiplying each number of the path by x, I cannot manipulate icons at all. In this case move a specific element of the icon.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:39:55+00:00Added an answer on June 17, 2026 at 4:39 am

    You need to split up the path in order to adjust the position of the triangle. I was able to do this by eye by picking out where the second “M” was in the path:

    var playB = Raphael('playB', 200, 200);
    var circle =          playB.path("M64,5.864C31.892,5.864,5.864,31.892,5.864,64c0,32.108,26.028,58.136,58.136,58.136c32.108,0,58.136-26.028,58.136-58.136C122.136,31.892,96.108,5.864,64,5.864z");
    var triangle =  playB.path("M26.736,102.728L97.264,62L26.736,21.272V102.728z");
    

    Then you can move the triangle over:

    triangle.attr("transform", "T15,0");
    

    To keep the properties and animation intact, add both to a Raphael set:

    var playBP = playB.set();
    playBP.push(circle, triangle);
    playBP.attr({
      'stroke-width': 5,
      'stroke': "#000",
      'fill': "#fff",
      'opacity': 1
    });
    

    Then you only need one small change: Change “this” in the mouseover commands to “playBP”. This may seem redundant, but “this” refers to the single element that was moused over, not the set.

    var speed = 5;
    
    playBP.mouseover(function(){
      playBP.animate({
        'stroke-width': 10,
        'stroke': "#fff",
        'fill': "#000",
        'opacity': .9
      }, 1000, 'elastic');
    
    });
    playBP.mouseout(function(){
      playBP.stop().animate({
        'stroke-width': 5,
        'stroke': "#000",
        'fill': "#fff",
        'opacity': 1    
      }, speed*4, 'elastic');
    
    });
    

    jsFiddle updated

    If you’d rather just fix the path, you can use the Raphael.mapPath() function to get the adjusted x/y for the triangle, like so:

    console.log(Raphael.mapPath(triangle.attr("path"), triangle.matrix));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Raphael library to create SVG objects. To initialise the SVG shape
If I create a Label using Raphael, the default style is a black block
I am using Raphael to create a vector shape and fill it with a
I have created a vector graphic using Raphael JS - specifically a circle. I
I am using Raphael and I want to create a rect and control the
I'm trying to create an image animation using Raphael JS. I want the effect
So I have been using raphael to create a user interface and want it
I am using Raphael.js to create polygons, (or actually closed paths) over an image.
I'm attempting to create an animated menu bar using raphael.js. It works fine in
I'm using Raphael js framework to create interactive svg image on client: var paper

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.