メニュー 閉じる

098. p5.jsで円を描きながらちょっと変則的なドローイングしてみる

単純ですが、結果が面白かったので。

http://www.velvet-number.com/p5_test/test067/

var angle = 0;
var amp01 = 0;
var amp02 = 0;

function setup () {

	pixelDensity (displayDensity ());
	createCanvas (windowWidth, windowHeight);
	colorMode (RGB, 256);
	background (0);

}

function draw () {

	amp01 = (mouseX - pmouseX) * 10 + 100;

	var pointx01 = mouseX + amp01 * cos (angle);
	var pointy01 = mouseY + amp01 * sin (angle)

	stroke (255);
	point (pointx01, pointy01);

	amp02 = (mouseX - pmouseX) * 2;

	for (var i = 0; i < TWO_PI; i+= 0.01) {
		var pointx02 = pointx01 + amp02 * cos (i);
		var pointy02 = pointy01 + amp02 * sin (i);
		stroke (255);
		point (pointx02, pointy02);
	}

	angle += 0.01;

}

 

Posted in p5.js , processing