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

  • SEARCH
  • Home
  • 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 8359827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:16:33+00:00 2026-06-09T11:16:33+00:00

Example here: http://jsfiddle.net/dhREK/32/ With Raphael JS I’m creating a series of triangles using a

  • 0

Example here: http://jsfiddle.net/dhREK/32/

With Raphael JS I’m creating a series of triangles using a for loop. After creating the triangles I want to be able to animate any one of them by selecting the raphael objects by index, something like:

tri[1]

or

tri.1

but I’m not sure of the right syntax. In any case, using

tri.animate({fill: '#ff0000'}, 400)

only animates the last triangle.

How can I specifically select the other nodes?

Thanks!

var paper = new Raphael(0, 0, 500, 500);

for(var i = 0; i < 6; i++) {
    var coords = 'M 43 0 L 74 63 L 13 63 Z';

    if(i % 2) {
        coords = 'M 43 63 L 74 0 L 13 0 Z';                      
    }

    var tri = paper.path(coords).attr({
       'fill' : '#000',
        'stroke-width' : '0'
    });

    tri.transform('T'+i * 34+',0');
}


tri.animate({fill: '#ff0000'}, 400)

PS: I was able to get all of the children of my paper as jquery objects (as seen in the jsfiddle link), but using animate() on a jquery object does not allow me to animate the raphael properties… any comment on that would be much appreciated as well!

  • 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-09T11:16:36+00:00Added an answer on June 9, 2026 at 11:16 am

    Turn tri into an array.

    var paper = new Raphael(0, 0, 500, 500),
        tri = [];
    
    for(var i = 0; i < 6; i++) {
        var coords = 'M 43 0 L 74 63 L 13 63 Z';
    
        if(i % 2) {
            coords = 'M 43 63 L 74 0 L 13 0 Z';                      
        }
    
        tri[i] = paper.path(coords).attr({
           'fill' : '#000',
            'stroke-width' : '0'
        });
    
        tri[i].transform('T'+i * 34+',0');
    }
    
    
    tri[1].animate({fill: '#ff0000'}, 400);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I put my example code here http://jsfiddle.net/8epWm/2/ I want to enable zClip on an
i have this simple example here : http://jsfiddle.net/pTyvc/1/ i don't want the sub_menu div
For example here http://jsfiddle.net/jitendravyas/5Wqn4/1/ I want to take <h1> over red area. How to
You can see the example here: http://jsfiddle.net/8EHED/8/ This is a tricky problem because I
I'm working on a jquery carousel. You can see the example here: http://jsfiddle.net/6fwbS/2/ Click
I've created an example of the problem here: http://jsfiddle.net/JustinN/qWeLT/1/ My actual code is hooked
Here an example http://jsfiddle.net/EhLsT/ $(window).scroll(function () { if ($(window).scrollTop() > $(#header).offset().top) { $(#floating).show(); }
Here an example http://jsfiddle.net/7aVXc/ Let' say current image height is 400px . How do
Here an example http://jsfiddle.net/NuzDj/ If you resize windows size, sidebar overlapping the wrapper &
Here's an example: http://jsfiddle.net/7g8GD/1/ Once you have entered an invalid input and hit enter

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.