Raphael drawing. Circle with two sectors from different images

北城余情 提交于 2019-12-11 11:44:06

问题


How to draw circle filled by image and how to draw the sector of such circle? Is it possible to animate drawing sector (for example animate it's size by increasing angle)? What if I want to draw first sector from @image1@ and another sector from @image2@?


回答1:


To draw a circle filled by image you... simply draw the circle and fill it with an image :D

var c = paper.circle(200, 200, 40);
c.attr({fill:"url(http://path_to_the_image.png)"});

About drawing a sector I think that you actually have to draw a path and then fill it the same way like the circle. Using this technique you also solved the probelm of 2 sectors with different image fills :)

To animate the arc take a look at this example on raphalejs website



来源:https://stackoverflow.com/questions/7976838/raphael-drawing-circle-with-two-sectors-from-different-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!