Rainbow
Introduction
Make a beautiful rainbow on your horizon!
Chat command
Put in an ||player:on chat command||
and rename it to rainbow.
player.onChat("rainbow", function () {
})
Set the radius
To set the size of the rainbow, make a variable named ||variables:radius||
. Put it in the ||loops:on start||
and set it to 100
.
let radius = 100
player.onChat("rainbow", function () {
})
Get player’s position
Save the player’s current position as the horizon where the rainbow appears. Use a variable named ||variables:horizon||
in the ||player:on chat command||
and set it to ||player:player world position||
.
let radius = 100
player.onChat("rainbow", function () {
let horizon = player.position()
})
Draw a circle
The rainbow will have 7 color bands which arc in a semicircle at the horizon. Make the first color band by pulling in a ||shapes:circle of||
from ||shapes:SHAPES||
into ||player:on chat command||
(you can find ||shapes:SHAPES||
in the Advanced portion of the Toolbox). Change the block to Red Concrete and use the ||variables:horizon||
variable for the center.
let radius = 100
player.onChat("rainbow", function () {
let horizon = player.position()
shapes.circle(
RED_CONCRETE,
horizon,
5,
Axis.X,
ShapeOperation.Replace
)
})
Make a circle outline
Use the ||variables:radius||
variable for the ||shapes:radius||
value in ||shapes:circle of||
. Make the shape operation be ||shapes:outline||
instead of ||shapes:replace||
.
let radius = 100
player.onChat("rainbow", function () {
let horizon = player.position()
shapes.circle(
RED_CONCRETE,
horizon,
radius,
Axis.X,
ShapeOperation.Outline
)
})
Second layer
Duplicate the ||shapes:circle of||
and place the new copy just below the first one. In the new ||shapes:circle of||
, change the block to Orange Concrete. Now, go to ||math:MATH||
and get a ||math:0 - 0||
. Put it in for the ||shapes:radius||
value of the new ||shapes:circle of||
. Change the ||math:0 - 0||
expression so that it subtracts 1 from the ||variables:radius||
variable.
let radius = 100
player.onChat("rainbow", function () {
let horizon = player.position()
shapes.circle(
RED_CONCRETE,
horizon,
radius,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
ORANGE_CONCRETE,
horizon,
radius - 1,
Axis.X,
ShapeOperation.Outline
)
})
Third layer
Copy the second ||shapes:circle of||
and place it at the end of ||player:on chat command||
. In that new copy, change the block to Yellow Concrete and set the ||shapes:radius||
value to ||variables:radius||
minus 2.
let radius = 100
player.onChat("rainbow", function () {
let horizon = player.position()
shapes.circle(
RED_CONCRETE,
horizon,
radius,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
ORANGE_CONCRETE,
horizon,
radius - 1,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
YELLOW_CONCRETE,
horizon,
radius - 2,
Axis.X,
ShapeOperation.Outline
)
})
More layers
Copy the last ||shapes:circle of||
and place it at the end of ||player:on chat command||
. In that new copy, change the block to Lime Concrete and set the ||shapes:radius||
value to ||variables:radius||
minus 3. Repeat what you just did with ||shapes:circle of||
but change the block to Light Blue Concrete and set the ||shapes:radius||
value to ||variables:radius||
minus 4.
let radius = 100
player.onChat("rainbow", function () {
let horizon = player.position()
shapes.circle(
RED_CONCRETE,
horizon,
radius,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
ORANGE_CONCRETE,
horizon,
radius - 1,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
YELLOW_CONCRETE,
horizon,
radius - 2,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
LIME_CONCRETE,
horizon,
radius - 3,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
LIGHT_BLUE_CONCRETE,
horizon,
radius - 4,
Axis.X,
ShapeOperation.Outline
)
})
Last layers
Again, copy the last ||shapes:circle of||
and place it at the end of ||player:on chat command||
. In that new copy, change the block to Blue Concrete and set the ||shapes:radius||
value to ||variables:radius||
minus 5. Repeat what you just did with ||shapes:circle of||
but change the block to Purple Concrete and set the ||shapes:radius||
value to ||variables:radius||
minus 6.
let radius = 100
player.onChat("rainbow", function () {
let horizon = player.position()
shapes.circle(
RED_CONCRETE,
horizon,
radius,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
ORANGE_CONCRETE,
horizon,
radius - 1,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
YELLOW_CONCRETE,
horizon,
radius - 2,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
LIME_CONCRETE,
horizon,
radius - 3,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
LIGHT_BLUE_CONCRETE,
horizon,
radius - 4,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
BLUE_CONCRETE,
horizon,
radius - 5,
Axis.X,
ShapeOperation.Outline
)
shapes.circle(
PURPLE_CONCRETE,
horizon,
radius - 6,
Axis.X,
ShapeOperation.Outline
)
})
Show the rainbow!
Go to the chat command in Minecraft and type rainbow. Move back and watch your beautiful rainbow form in the sky! If you want a bigger or smaller rainbow, just change the setting of the ||variables:radius||
variable in ||loops:on start||
.