pxt-ev3/docs/tutorials/make-an-animation.md
Galen Nickel 49ab5ec099
Shrink some of the tutorial sentences (#440)
* Shrink some of the tutorial sentences

* Match the less than order for blocks

* Include later tutorials in SUMMARY

* Ditch 'using' in name
2018-04-05 17:32:32 -07:00

1.8 KiB
Raw Blame History

Make a custom animation

Introduction @fullscreen

Create a custom animation for your @boardname@.

Button press on brick

Step 1

Open the ||brick:Brick|| Toolbox drawer. Drag out a ||brick:show string|| block onto the Workspace, and drop it into the ||loops:on Start|| block. You should hear and see the block click into place.

brick.showString("Hello world", 1) 

Step 2

In the ||brick:show string|| block, type the text "Press my button" to replace "Hello world".

brick.showString("Press my button!", 1) 

Step 3

Open the ||brick:Brick|| Toolbox drawer. Drag out an ||brick:on button|| block onto anyplace in the Workspace.

brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () { 
 
}) 
brick.showString("Press my button!", 1) 

Step 4

Open the ||brick:Brick|| Toolbox drawer. Drag out a ||brick:show image|| block onto the Workspace, and drop it into the ||brick:on button|| block.

brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () { 
    brick.showImage(images.expressionsBigSmile) 
}) 
brick.showString("Press my button!", 1) 

Step 5

Open the ||brick:Brick|| Toolbox drawer. Drag out a ||brick:set status light|| block onto the Workspace, and drop it into the ||brick:on button|| block after the ||brick:show image|| block.

brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () { 
    brick.showImage(images.expressionsBigSmile) 
    brick.setStatusLight(StatusLight.Orange) 
}) 
brick.showString("Press my button!", 1) 

Step 6

Now, plug your @boardname@ into the computer with the USB cable, and click the Download button at the bottom of your screen. Follow the directions to save your program to the brick.