Draw probelm

Discussion in 'Rebol' started by MaxV, Jun 25, 2010.

  1. MaxV

    MaxV Member

    Hello,
    I try to draw a spline with draw, but I don't know how to send the coordinates:
    Code:
     view layout [ box 100x100 effect [ draw [
                spline 10 closed 20x20  25x90 80x80 70x25
                 ]]]
    
    it's ok, but:
    Code:
     view layout [ box 100x100 effect [ draw [
                spline 10 closed [20x20  25x90 80x80 70x25]
                 ]]]
    
    It's a mess, Rebol go in crash or don't get the series.
    May you help me?
  2. Graham

    Graham Developer Staff Member

    From James Marsden

    Code:
    
    rebol[]
    random/seed now/time
    beats: copy [4 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 4 0 0 0 0 0 
    0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    heartbeat: func [/local g n p beatpart][
        g: copy []
        p: copy []
        beatpart: copy/part beats 24
        repeat n length? beatpart [
            append p compose [(as-pair n * 10 (beatpart/:n) * -10) (as-pair 
    (n * 10) + 5 (beatpart/:n) * 10)]
        ]
        append g compose/deep [
            translate 0x60
            fill-pen off
            line-width 5
            pen 0.255.0.200
            spline 20 (p)
            line-width 1
            pen 0.255.100
            spline 20 (p)
        ]
        append beats first beats
        remove beats
        return g
    ]
    view layout/size [
        at 10x10 box 260x120 black edge [size: 0x0] rate 0:00:0.1 effect 
    [draw[]] feel [
            engage: func [f a e][
                if a = 'time [f/effect/draw: heartbeat show f]
            ]
        ]
    ] 280x140
    
    
  3. MaxV

    MaxV Member

    Ok, so with:
    Code:
    b:  [20x20 10x10 15x25 35x25]
    a: compose [spline 20 (b)]
    view layout [box effect [draw a]]
    
    I resolve all.
    Thank you

Share This Page