Smoothly animate attribute changes to ~3000 Raphael objects at once

后端 未结 4 1829
深忆病人
深忆病人 2021-01-06 03:08

UPDATED QUESTION I\'ve updated this to be a little more succinct..:

In this fiddle: http://jsfiddle.net/pX2Xb/4/ I have some raphael code that draws

4条回答
  •  滥情空心
    2021-01-06 03:52

    Did you write all the paths manually? I think is better if you put all the paths in an object. Then you can iterate the object and draw all the paths using, for example, for in. In that process you can give an internal ID to every path using element.id = 'name'. Once you have all the internal ID´s and the paths drawed, you can use the getById method: getById('pathId') If you are going to use Sets I recommend you to use Clousures, you can first declare the variables

    var setName = Paper.Set()
    

    and then push the paths in another loop

    for (countie in Lousiana){
        setName.push(countie)
    }
    

    Then you have methods like Paper.forEach() if you want to apply some attributes to the elements. Or Set.FotEach(). Both take a callback function like argument, and then executes that function in each iteration.

    If you want to share your code it wouldn´t be a problem for me to check it out and give my opinion on how to solve some of the situations. I´m also working with maps, I´m developing an Educative Video Game, if you want I can also share my code with you, there aren´t that much documentation about Raphael, so it would be useful for me to see how are you using it and maybe the same for you.

    Bye!

提交回复
热议问题