|
1 | 1 | # snowflake |
| 2 | + |
2 | 3 | makecode snow flake extension for 16x16 neopixel matrix display |
| 4 | + |
| 5 | +Author: shaoziyang |
| 6 | +Date: 2018.Dec |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +## Add extension |
| 11 | + |
| 12 | +open your microbit makecode project, in Add extension, paste |
| 13 | + |
| 14 | +https://github.com/makecode-extensions/snowflake |
| 15 | + |
| 16 | +to search box then search. |
| 17 | + |
| 18 | + |
| 19 | +## Basic usage |
| 20 | +``` |
| 21 | +snowflake.config( |
| 22 | +DigitalPin.P1, |
| 23 | +true, |
| 24 | +8, |
| 25 | +50, |
| 26 | +1, |
| 27 | +50 |
| 28 | +) |
| 29 | +snowflake.start() |
| 30 | +``` |
| 31 | + |
| 32 | +## API |
| 33 | + |
| 34 | + |
| 35 | +- **function load_background(dat: number[])** |
| 36 | +Load a user back ground picture. |
| 37 | +You may using microbittoolbox to convert data and paste to javascript code. |
| 38 | +https://github.com/shaoziyang/microbit-lib/tree/master/utils/microbit_toolbox |
| 39 | + |
| 40 | +- **function load_default_backgroud()** |
| 41 | +Load default back ground: christmas tree |
| 42 | + |
| 43 | +- **function config(pin: DigitalPin, cover: boolean, threshold: number, snowfall: number, MostAtATime: number, speed: number)** |
| 44 | +configurate snow, you may adjust paramters to get different effect. |
| 45 | + * pin, which is used to control neopixel matrix |
| 46 | + * cover, enable/disable snow cover effect |
| 47 | + * threshold, snow cover threshold, range is [1-100] |
| 48 | + * snowfall, how much snow is falling, range is [1-100] |
| 49 | + * MostAtATime, new snowflake most at a time |
| 50 | + * speed, snowfall speed, the bigger the slower |
| 51 | + |
| 52 | + |
| 53 | +- **function start()** |
| 54 | +start/resume snowfall. Function start() need to be called only once, not in a loop. |
| 55 | + |
| 56 | +- **function pause()** |
| 57 | +pause snowfall. |
| 58 | + |
| 59 | +- **function reset()** |
| 60 | +restart. |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +## Demo |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +## License |
| 71 | + |
| 72 | +MIT |
| 73 | + |
| 74 | +Copyright (c) 2018, microbit/micropython Chinese community |
| 75 | + |
| 76 | +## Supported targets |
| 77 | + |
| 78 | +* for PXT/microbit |
| 79 | + |
| 80 | +[From microbit/micropython Chinese community](http://www.micropython.org.cn) |
0 commit comments