pxt-calliope/docs/reference/led/fade-in.md

35 lines
896 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# Fade in
2016-04-13 17:27:45 +02:00
Gradually increase the [LED screen](/device/screen) brightness until the LED lights are at full brightness.
2016-03-26 00:47:20 +01:00
```sig
led.fadeIn(700);
```
### Parameters
2016-04-13 17:27:45 +02:00
* ms - [Number](/reference/types/number); the speed by which the screen brightness is increased, expressed in milliseconds (1,000 milliseconds = 1 second). The smaller the number the faster the screen brightness increased.
2016-03-26 00:47:20 +01:00
### Example: fading dot
The following code turns on centre LED and then gradually increases and decreases the screen brightness (the centre LED pulses 5 times):
```blocks
led.plot(2, 2)
for (let i = 0; i < 5; i++) {
led.setBrightness(0)
led.fadeIn(100)
basic.pause(100)
led.fadeOut(100)
}
```
### Lessons
2016-04-13 17:27:45 +02:00
[glowing sword](/lessons/glowing-sword)
2016-03-26 00:47:20 +01:00
### See also
2016-04-13 17:27:45 +02:00
[brightness](/reference/led/brightness), [fade out](/reference/led/fade-out), [set brightness](/reference/led/set-brightness)
2016-03-26 00:47:20 +01:00