mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Small clean ups in Nyan Rainbow example.
This commit is contained in:
parent
9679881eef
commit
3f7cc316c1
1 changed files with 13 additions and 10 deletions
|
@ -46,11 +46,12 @@
|
||||||
var count = 50;
|
var count = 50;
|
||||||
|
|
||||||
// Create a symbol, which we will use to place instances of later:
|
// Create a symbol, which we will use to place instances of later:
|
||||||
var path = new Path.Circle(new Point(0, 0), 5);
|
var path = new Path.Circle({
|
||||||
path.style = {
|
center: new Point(0, 0),
|
||||||
|
radius: 5,
|
||||||
fillColor: 'white',
|
fillColor: 'white',
|
||||||
strokeColor: 'black'
|
strokeColor: 'black'
|
||||||
};
|
});
|
||||||
|
|
||||||
var symbol = new Symbol(path);
|
var symbol = new Symbol(path);
|
||||||
|
|
||||||
|
@ -60,11 +61,12 @@
|
||||||
var center = Point.random() * view.size;
|
var center = Point.random() * view.size;
|
||||||
var placed = symbol.place(center);
|
var placed = symbol.place(center);
|
||||||
placed.scale(i / count + 0.01);
|
placed.scale(i / count + 0.01);
|
||||||
placed.data = {};
|
placed.data = {
|
||||||
placed.data.vector = new Point({
|
vector: new Point({
|
||||||
angle: Math.random() * 360,
|
angle: Math.random() * 360,
|
||||||
length : (i / count) * Math.random() / 5
|
length : (i / count) * Math.random() / 5
|
||||||
});
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var vector = new Point({
|
var vector = new Point({
|
||||||
|
@ -113,8 +115,9 @@
|
||||||
var paths = [];
|
var paths = [];
|
||||||
var colors = ['red', 'orange', 'yellow', 'lime', 'blue', 'purple'];
|
var colors = ['red', 'orange', 'yellow', 'lime', 'blue', 'purple'];
|
||||||
for (var i = 0; i < colors.length; i++) {
|
for (var i = 0; i < colors.length; i++) {
|
||||||
var path = new Path();
|
var path = new Path({
|
||||||
path.fillColor = colors[i];
|
fillColor: colors[i]
|
||||||
|
});
|
||||||
paths.push(path);
|
paths.push(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue