官术网_书友最值得收藏!

Exercise 1.1

Modify the previous example in such a way that the sine wave is drawn using all the colors of the rainbow. The drawing loop should look like the following:

(-> (js/rx.zip sine-wave rainbow-colours) 
    (pipe (rx-take 700))
    (.subscribe (fn [[{:keys [x y]} colour]] 
                  (fill-rect x y colour)))) 

Your task is to implement the rainbow-colours stream. As everything up until now has been very light on explanations, you might choose to come back to this exercise later, once we have covered more about CES.

The repeat, scan, and flatMap functions may be useful in solving this exercise. Be sure to consult RxJs' API at https://rxjs-dev.firebaseapp.com/guide/overview for more information.

主站蜘蛛池模板: 扬州市| 昭平县| 巧家县| 塘沽区| 衡东县| 舞钢市| 虎林市| 盐源县| 黄山市| 武乡县| 江油市| 甘洛县| 遂川县| 小金县| 丰镇市| 剑阁县| 东乡| 常山县| 罗田县| 阿勒泰市| 土默特左旗| 芜湖县| 南充市| 海阳市| 江油市| 抚远县| 香港 | 定襄县| 永兴县| 岳西县| 新宁县| 大石桥市| 平罗县| 平湖市| 西城区| 定州市| 临城县| 深水埗区| 瑞安市| 灌阳县| 会东县|