简体   繁体   中英

How do I rotate a line in ruby shoes?

The rotate command in shoes rotates the entire canvas around its upper left corner. I only want to rotate a line (or other shape) around its own corner, though. How do I do that?

Rotate does not really rotate the already drawn figure etc. You actually apply it to the "pen" drawing on the canvas before the begining of the drawing it is like to turn your page on which you draw by some angle. You should therefore use it like that:

Shoes.app do
 line 20,20, 50, 50
 rotate 90
 stroke red
 line 20,20,50,50
end 

Notice the difference between red and black line

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM