Sg2.9
Working with random position...
Recent RSS
Working with random position for symbols
Date:  25. June 2015, 01:01

Hello, I'm currently working with the Graffmaster Script. I want to use symbols that works in random positions and sizes, but all I get is the symbol in the middle and not in random positions.

This is what I have at the moment.
Any help will be valuable for me.

Thanks

var values = {
	size: 50,
	radius: 100,
	dichte: 10
}

function onOptions() {
	values = Dialog.prompt('graffmaster:', {
		size: { description: 'size' },
		radius: { description: 'radius' },
		dichte: { description: 'dichte' }
	}, values);
}

function onMouseDrag(event) {
	for (var i = 1; i < values.dichte; i++) {
		var rotation = (Math.random() * 360).toRadians();
		var rota = (Math.random() * 105).toRadians();
		var ro = (Math.random() * 240).toRadians();
		var roma = (Math.random() * 45).toRadians();
		var rad = new Point(values.radius * Math.random(), values.radius * Math.random());
		var center = event.point + rad.rotate(rotation);
		var cen = event.point + rad.rotate(rota);
		var cento = event.point + rad.rotate(ro);
		var centoro = event.point + rad.rotate(roma);
		var newSize = values.size * Math.random();
		var newSi = values.size * Math.random();
		var newSixe = values.size * Math.random();
		var RegularPolygon = new Path.RegularPolygon(cen, 5, newSi);
		var Triangle = new Path.RegularPolygon(cento, 3, newSixe);
		var Circle = new Path.Circle(center, newSize);
		RegularPolygon.fillColor = new CMYKColor(0.1, 0, 1, 0);
		Circle.fillColor = new CMYKColor(Math.random(), 1, 0, 0);
		Triangle.fillColor = new CMYKColor(1, 0, 0, 0);
		var symbol = document.symbols['Rocket'];
		var placedSymbol = new PlacedSymbol(symbol, centoro);
		var symbol = document.symbols['Ro'];
		var placedSymbol = new PlacedSymbol(symbol, cento);
		var symbol = document.symbols['Ret'];
		var placedSymbol = new PlacedSymbol(symbol, cen);
	}
}
Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Stroke <-> Fill 09.01.08