rainbow.js shows an example of how to use the new arc() method
This commit is contained in:
parent
86fd3c0a28
commit
ca821a696a
2 changed files with 44 additions and 0 deletions
32
src/main/javascript/drone/rainbow.js
Normal file
32
src/main/javascript/drone/rainbow.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
load(__folder + "drone.js");
|
||||||
|
/*
|
||||||
|
Creates a Rainbow
|
||||||
|
*/
|
||||||
|
Drone.extend('rainbow', function(radius){
|
||||||
|
if (typeof radius == "undefined")
|
||||||
|
radius = 12;
|
||||||
|
|
||||||
|
this.chkpt('rainbow');
|
||||||
|
this.down(radius);
|
||||||
|
var colors = [blocks.wool.red,
|
||||||
|
blocks.wool.orange,
|
||||||
|
blocks.wool.yellow,
|
||||||
|
blocks.wool.lime,
|
||||||
|
blocks.wool.blue,
|
||||||
|
blocks.wool.purple];
|
||||||
|
|
||||||
|
for (var i = 0;i < colors.length; i++) {
|
||||||
|
|
||||||
|
var bm = this._getBlockIdAndMeta(colors[i]);
|
||||||
|
|
||||||
|
this.arc({
|
||||||
|
blockType: bm[0],
|
||||||
|
meta: bm[1],
|
||||||
|
radius: radius-i,
|
||||||
|
strokeWidth: 2,
|
||||||
|
quadrants: {topright: true,
|
||||||
|
topleft: true},
|
||||||
|
orientation: 'vertical'}).right().up();
|
||||||
|
}
|
||||||
|
return this.move('rainbow');
|
||||||
|
});
|
12
src/main/javascript/drone/test.js
Normal file
12
src/main/javascript/drone/test.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
load (__folder + "drone.js");
|
||||||
|
|
||||||
|
Drone.prototype.testStrokeWidth = function(){
|
||||||
|
this.arc({
|
||||||
|
blockType: 42,
|
||||||
|
meta: 0,
|
||||||
|
radius: 8,
|
||||||
|
strokeWidth: 3,
|
||||||
|
quadrants: {topright:true},
|
||||||
|
world: this._getWorld()
|
||||||
|
});
|
||||||
|
};
|
Reference in a new issue