Graphics: rotated rectangle?

Hi…,

I play with the new cc.Graphics of Cocos Creator 1.2, it’s very nice.

I want to draw a rotated rectangle. Is there a rotation matrix or so? Or do I have to draw a polyline and rotate the points by myself?

Thanks

Michael

You can rotate the node, or rotate the points yourself.

You can also try this lib: https://github.com/2youyou2/ccc.raphael
Here is the example : https://github.com/2youyou2/raphael-example

Hi jyinkailej,

thank you for information. I’ve tried the raphael example with the copying in the raphael lib but got this error in Cocos Creator 1.2:

[require] Cannot find module 'cheerio' from '\temp\scripts\assets\raphael\component'

I will try a own rotation function.

Cheers

Michael

hi @jyinkailej I’ve tried your projects and Im having the same problem with missing component on raphael project. Is there anything we can do to fix it?
Thanks for sharing!

Did you follow the steps?

git clone https://github.com/2youyou2/raphael-example.git
git submodule update --init
npm install

No, I didnt. I just downloaded the project.
But I will do it now. Thanks!

FYI: The library does not work with certain SVG files.

1 Like

cool! Thanks!

Can anyone share how you included Raphael in your own project? I can open and edit the examples, but don’t know how to include Raphael on my own project :frowning: