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

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.

主站蜘蛛池模板: 乐安县| 泰州市| 龙岩市| 浠水县| 临洮县| 阳春市| 芜湖市| 大方县| 巴楚县| 阳春市| 兰溪市| 聂拉木县| 镇江市| 天峨县| 永州市| 嘉义县| 同仁县| 新宁县| 玉门市| 齐河县| 宜都市| 南和县| 沙田区| 建瓯市| 扎兰屯市| 瓮安县| 金华市| 沐川县| 临沂市| 宁海县| 禹州市| 垦利县| 沽源县| 丹寨县| 乡城县| 尤溪县| 赣州市| 教育| 长海县| 镇远县| 延津县|