初等函数的视觉实验
y=pow(2,x) y = log(x) y=sqrt(x)
函数的数值变化规律
pow(2^x) 简单版水波扩散
//processing IDEArrayList<PVector> pos;ArrayList<Cs> cs;void setup() {size(640, 290);pos = new ArrayList<PVector>();cs = new ArrayList<Cs>();}void draw() {background(0);generate();for (int i = pos.size()-1; i>=0; i--) {cs.get(i).editvalue(pos.get(i).x, pos.get(i).y);if (cs.get(i).Dead()) {cs.remove(i);pos.remove(i);}}fill(255);text(nfc(frameRate, 1), 20, 20);}void generate() {float d = dist(mouseX, mouseY, pmouseX, pmouseY);println(d);if (d > 12) {cs.add( new Cs());pos.add(new PVector(mouseX, mouseY));}}class Cs {float r;float alpha = 255;float zs = 0;float bs = 0;Cs() {r = random(1, 170);}void editvalue(float x, float y) {bs = pow(2, -zs);noFill();stroke(255, alpha*bs);strokeWeight(2);ellipse(x, y, r*(1-bs), r*(1-bs) );zs+=0.06;}boolean Dead() {if (alpha*bs <=1) {return true;} else {return false;}}}
三角函数周期性运动
x=sin(angle)*r y = cos(angle)*r
视频素材来自傲视网
后未来数字内容创作体
Comments
Please Log in or Register to comment