📄 windmills1.java
字号:
import java.awt.*;
public class Windmills1 extends Movie {
public Picture scene(double t) {
int rate = 5;
// How many degrees the sails turn per unit time.
Picture sun =
Picture.circle(Color.yellow).size(50)
.at(350+0.07*t, 460-0.03*t);
Paint haze =
new GradientPaint(0,100,Color.lightGray, 0,480,Color.blue);
Picture sky = Picture.box(haze).scale(640,380).at(0,100);
Color midGreen = new Color(0,180,0);
Paint groundPaint =
new GradientPaint(0,0,midGreen, 0,100,Color.gray);
Picture ground = Picture.box(groundPaint).scale(640,100);
Picture background = ground.over(sun).over(sky);
Picture sail = Picture.box(Color.red).scale(50,150)
.at(0,50)
.over(Picture.box(Color.red).scale(10,50))
.at(-5,0);
Picture sails = sail
.over(sail.turn(90))
.over(sail.turn(180))
.over(sail.turn(270));
Picture tower = Picture.box(Color.white)
.scale(100,300)
.at(-50,0)
.over(Picture.triangle
(50,300, -50,300, 0,350, Color.white));
Picture windmill = sails.turn(rate*t).at(0,270)
.over(tower)
.at(0,-30);
Picture row = new Empty();
double s = 1.0;
double x = 400;
for (int i = 0; i < 10; i++) {
row = row.over(windmill.size(s).at(x,100));
s = s/2;
x = x/2;
}
return row.over(background);
}
/********************************************************/
public static void main(String[] a) {
Movie m1 = new Windmills1();
m1.setFrameRate(30);
m1.setAntialiasingOn(false);
m1.show(0,0,640,480,0.5,null);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -