Lab1 P2(MIT 6.031)(Turtle Graphic 龟图) Problem8:Personal Art
**
Personal Art (Turtle Graphic 龟图)
**
(Lab1 P2(MIT 6.031)(Turtle Graphic 龟图) Problem8:Personal Art)
【系彩虹大盘盘!!!ヾ(◍°∇°◍)ノ゙】
✧✧*。٩(ˊᗜˋ*)و✧*。
public static void drawPersonalArt(Turtle turtle)
【单位长度定义】
int sideLength = 8;
int sides = 360;
【随机取色的变量(事实上决定初始取色)】
int ran = (int)(Math.random()×(10));
【单位转角:1度】
double ang=1;
int r=(int)( sideLength / (Math.sin(Math.toRadians(ang))));
PenColor c;
【循环控制:360/2/2:每个单位的夹角+两个单位之间的转角】
for(int i=0;i<sides/4;i++) {
c = PenColor.getColor(++ran);
【炫彩效果:跳过黑色和灰色(非常重要)】
if(c.getIndex()==0) {
ran=ran+1;
c = PenColor.getColor(++ran);
}
if(c.getIndex()==1) {
c = PenColor.getColor(++ran);
}
turtle.color(c);
【每个单位:画“8”字】
turtle.forward(r);
turtle.turn(90+ang/2);
turtle.forward(sideLength);
turtle.turn(90+ang/2);
turtle.forward(2×r);
turtle.turn(180+90-ang/2);
turtle.forward(sideLength);
turtle.turn(180+90-ang/2);
turtle.forward(r);
【单位间转角】
turtle.turn(ang×2);
**
【迷幻效果!!!(✪ω✪)!!!✧✧✧】
**
ヾ(*ΦωΦ)ツ>>>>>>>☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
虚焦观看可见中心向外扭曲放射。
亲测:400度近视摘下眼镜距离屏幕一尺
视力健康者双眼虚焦可获得同等效果。
锵锵✧。٩(ˊᗜˋ*)و✧*。*