2017
08-10

# 第四期 Processing分形之一——Wallpaper

``````/**
* Wallpaper
* 微信公众号：维度模态
* 作者：Hewes
*/

size(800, 800);  //画布尺寸
background(0);  //背景色

//相关参数的设定
//double a = 0.50, b = 2.00, c = 0.00;
//int mag=60;
//double a = 0.4, b = 1, c = 0;
//int mag=100;
//double a = 1, b = 4, c = 60;
//int mag=1;
//double a = -1, b = -2, c = -3;
//int mag=5;
double a = -1000, b = 0.1, c = -10;
int mag=10;

double x1=0, y1=0, temp;  //涉及变量

for (int i = 0; i < 2550000; i++) {
//壁纸公式：
//xn+1 = yn - sign(xn) | b xn - c |1/2
//yn+1 = a - xn
temp = x1;
x1 = y1 - Math.signum(a * x1) * Math.sqrt(Math.abs(b * x1 - c));
y1 = a - temp;

//放大+平移
int m = (int) (x1 * mag + width/2);
int n = (int) (y1 * mag + height/2);
//笔触颜色设置
stroke(255, i/10000, i/10000);
//stroke(255-i/10000,255-i/10000, 0);
point(m, n);
}``````

Run the above code，you may get:

//相关参数设定

double a = 1, b = 4, c = 60;
int mag=1;

double a = –1000, b = 0.1, c = –10;
int mag=10;

double a = –1, b = –2, c = –3;
int mag=5;

double a = 0.50, b = 2.00, c = 0.00;
int mag=60;

double a = 0.4, b = 1, c = 0;
int mag=100;

### 《第四期 Processing分形之一——Wallpaper》有 6 条评论

1. Essays 说：

college persuasive essay college essay writing college essays college essays

2. essays with citations college essay college essay help need help to write essay for medical school

3. college essays personal essay for college college essays college essay

4. college essays college essays college essay personal essay for college

5. need help to write essay for medical school writing a strong essay essay purchase college essays