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

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.

主站蜘蛛池模板: 通许县| 禹城市| 中超| 浪卡子县| 克什克腾旗| 陆丰市| 贵州省| 哈巴河县| 岳普湖县| 十堰市| 河源市| 封开县| 宁津县| 上饶县| 本溪市| 东乌| 遵义县| 玛沁县| 延津县| 友谊县| 三穗县| 通榆县| 北京市| 嵩明县| 独山县| 兴城市| 乐山市| 黄浦区| 高陵县| 通化县| 广元市| 香河县| 霞浦县| 岳阳市| 色达县| 哈密市| 南京市| 贵溪市| 屯门区| 旺苍县| 堆龙德庆县|