Improve Space examples.

This commit is contained in:
Jürg Lehni 2013-12-06 22:28:13 +01:00
parent 3263b91708
commit 7c5d377133
2 changed files with 10 additions and 8 deletions

View file

@ -10,11 +10,12 @@
var count = 150;
// Create a symbol, which we will use to place instances of later:
var path = new Path.Circle(new Point(0, 0), 5);
path.style = {
var path = new Path.Circle({
center: new Point(0, 0),
radius: 5,
fillColor: 'white',
strokeColor: 'black'
};
});
var symbol = new Symbol(path);
@ -23,11 +24,11 @@
// The center position is a random point in the view:
var center = Point.random() * view.size;
var placed = symbol.place(center);
placed.scale(i / count);
placed.data = {};
var scale = (i + 1) / count;
placed.scale(scale);
placed.data.vector = new Point({
angle: Math.random() * 360,
length : (i / count) * Math.random() / 5
length : scale * Math.random() / 5
});
}

View file

@ -17,10 +17,11 @@
for (var i = 0; i < count; i++) {
// The center position is a random point in the view:
var center = Point.random() * view.size;
var path = new Shape.Circle(center, 5 * (i / count));
var scale = (i + 1) / count;
var path = new Shape.Circle(center, 5 * scale);
path.data.vector = new Point({
angle: Math.random() * 360,
length : (i / count) * Math.random() / 5
length : scale * Math.random() / 5
});
}