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 7974465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:22:56+00:00 2026-06-04T08:22:56+00:00

I newbie to Raphael and i wanted raphael animation for multiple div. Currently i

  • 0

I newbie to Raphael and i wanted raphael animation for multiple div. Currently i have animation for single div. But i am unable to do for multiple div it get conflicts.

The following is code

http://tympanus.net/codrops/2011/04/22/animated-skills-diagram/

HTML

<div class="diagram"></div>
        <div class="get">
        <div class="arc">
                <span class="text">JavaScript</span>
                <input type="hidden" class="percent" value="95" />
                <input type="hidden" class="color" value="#97BE0D" />
        </div>
            <div class="arc">
                <span class="text">CSS3</span>
                <input type="hidden" class="percent" value="90" />
                <input type="hidden" class="color" value="#D84F5F" />
            </div>
       </div>

<div class="diagram"></div>
        <div class="get">
        <div class="arc">
                <span class="text">JavaScript</span>
                <input type="hidden" class="percent" value="95" />
                <input type="hidden" class="color" value="#97BE0D" />
        </div>
            <div class="arc">
                <span class="text">CSS3</span>
                <input type="hidden" class="percent" value="90" />
                <input type="hidden" class="color" value="#D84F5F" />
            </div>
       </div>

so on…

JAVASCRIPT

var o = {
    init: function(){
        this.diagram();

    },
    random: function(l, u){
        return Math.floor((Math.random()*(u-l+1))+l);
    },
    diagram: function(){
        var r = Raphael($('.diagram'),600,600),  //need effects for all the div
            rad =  3,
            defaultText = 'Skills',
            speed = 250;

        r.circle(300, 300, 20).attr({ stroke: 'none', fill: '#193340' });

        var title = r.text(300, 300, defaultText).attr({
            font: '12px Arial',
            fill: '#fff'
        }).toFront();

        r.customAttributes.arc = function(value, color, rad){
            var v = 3.6*value,
                alpha = v == 360 ? 359.99 : v,
                random = o.random(91, 240),
                a = (random-alpha) * Math.PI/180,
                b = random * Math.PI/180,
                sx = 300 + rad * Math.cos(b),
                sy = 300 - rad * Math.sin(b),
                x = 300 + rad * Math.cos(a),
                y = 300 - rad * Math.sin(a),
                path = [['M', sx, sy], ['A', rad, rad, 0, +(alpha > 180), 1, x, y]];
            return { path: path, stroke: color }
        }

        $('.get').find('.arc').each(function(i){
            var t = $(this), 
                color = t.find('.color').val(),
                value = t.find('.percent').val(),
                text = t.find('.text').text();

            rad += 17;  
            var z = r.path().attr({ arc: [value, color, rad], 'stroke-width': 12 });

            z.mouseover(function(){
                this.animate({ 'stroke-width': 20, opacity: .75 }, 1000, 'elastic');
                if(Raphael.type != 'VML') //solves IE problem
                this.toFront();
                title.stop().animate({ opacity: 0 }, speed, '>', function(){
                    this.attr({ text: text + '\n' + value + '%' }).animate({ opacity: 1 }, speed, '<');
                });
            }).mouseout(function(){
                this.stop().animate({ 'stroke-width': 12, opacity: 1 }, speed*4, 'elastic');
                title.stop().animate({ opacity: 0 }, speed, '>', function(){
                    title.attr({ text: defaultText }).animate({ opacity: 1 }, speed, '<');
                }); 
            });
        });

    }
}
$(function(){ o.init(); });

http://tympanus.net/codrops/2011/04/22/animated-skills-diagram/

  • 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-04T08:22:58+00:00Added an answer on June 4, 2026 at 8:22 am

    Its been a while since I’ve used this so correct me if I’m wrong, but:

    var r = Raphael($('.diagram'),600,600),  //need effects for all the div
                rad =  3,
                defaultText = 'Skills',
                speed = 250;
    

    The Raphael object creates a canvas and then you manipulate it, here you have multiple divs. Is the problem that Raphael is expecting a single element (why the author used id instead of styleclass) and the issue that your returning an array of elements?

    If this is the issue try getting all of the divs first and then execute this code for each div, not passing all the divs into this function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

newbie question in css: I have the following style defined: TABLE.tabulardata th { font:
I am a Raphael newbie and need some help with the following: I am
Newbie question here but for some reason I cant figure this out. I have
Newbie question i have following function: function isadult($description) { $bad=/*comma separated bad words*/; $bad=explode(,,$bad);
Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores Bezier
Newbie Warning I have a simple but vexing problem trying to disable an NSButton.
Newbie question... The objective: I intend to have an HTML text input field as
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
Newbie here, I have a struct for a word, which contains a char array
Newbie here. The following function works fine when $color refers to an entry in

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.