REBOL [
    Title: "'Busy' Style"
    Date: 25-Aug-2005
]

stylize/master [
    BUSY: FACE 35x35 with [
        colors: []
        effect: [draw []]
        state: false
        images: [
            scale 0.1 0.1 pen none
            fill-pen colors/1 box 160x20 190x100
            fill-pen colors/2 polygon 85x48 125x118 151x103 111x33
            fill-pen colors/3 polygon 33x111 103x151 118x125 48x85
            fill-pen colors/4 box 100x190 20x160
            fill-pen colors/5 polygon 48x266 118x226 102x200 33x240
            fill-pen colors/6 polygon 111x317 151x248 125x232 85x302
            fill-pen colors/7 box 160x330 190x250
            fill-pen colors/8 polygon 266x302 226x232 200x247 240x317
            fill-pen colors/9 polygon 317x240 247x200 232x226 302x266
            fill-pen colors/10 box 250x190 330x160
            fill-pen colors/11 polygon 302x85 232x125 248x151 317x111
            fill-pen colors/12 polygon 240x33 200x102 226x118 266x48
        ]
        images: reduce [images []]

        feel: make feel [
            engage: func [face action event][
                all [
                    find [time] event/type
                    head reverse next face/colors reverse face/colors
                    show face
                ]
            ]
        ]

        access: make access [
            get-face*: func [face][face/data]
            set-face*: func [face arg [logic! tuple! pair!]][
                switch type?/word arg [
                    logic! [
                        face/data/1: face/state: arg
                        face/rate: pick [30 #[none]] arg
                        face/effect/draw: pick face/images arg
                    ]
                    tuple! [
                        face/data/2: arg
                        clear face/colors
                        arg: arg * 1.1.1.0
                        repeat x 12 [
                            arg/4: switch/default x [1 [0] 2 [51] 3 [85] 4 [102]][119]
                            append face/colors arg
                        ]
                    ]
                    pair! [
                        face/size: arg
                        arg: min arg/x arg/y
                        face/images/1/2: face/images/1/3: arg / 350
                    ]
                ]
                show face
            ]
        ]
        init: [
            color: any [color 51.51.51]
            data: reduce [state color]
            set-face self size
            set-face self color
            set-face self state
            color: none
        ]
    ]
]