prev | index | next

Flash8 - blendMode
8
12
870 bytes
1412 bytes
2005-10-05 00:00:00
2005-10-05 15:37:42
Oldes (oliva.david@seznam.cz)


To test and demonstrate the blending modes

(swf8-blendmode.rswf)
background 255.255.255
include %includes/txt_info.rswf
shp_bg: shape [
    with transparency
    gradient [
        radial colors [
            0.0.0.255 0.0.255.255 0.255.0.255 255.0.0.0
        ]
    ]
    circle 160
]
shp_box: shape [
    with transparency
    gradient [
        radial colors [
            0.0.0.255 0.0.255.255 0.255.0.255 255.0.0.0
        ]
    ]
    box -70x-70 70x70
    circle 60
]
spr_bg:  sprite shp_bg
spr_box: sprite shp_box
bg: place spr_bg [at 160x160 blend "diference"]
box1: place spr_box at 120x120
box2: place spr_box at 200x120
box3: place spr_box at 120x200
box4: place spr_box at 200x200
doAction [
    modes: [
        "normal"
        "layer"
        "darken"
        "multiply"
        "lighten"
        "screen"
        "overlay"
        "hardLight"
        "add"
        "subtract"
        "diference"
        "invert"
        "alpha"
        "erase"
    ]
    i: 0
    
    ;I don't change the background,
    ;so I can cache it as a Bitmap:
    bg.cacheAsBitmap: true
    
    changeBlendModes: func[][
        mode: modes/:i
        info: reform ["Mode: " (i + 1) mode]
        box1.blendMode: mode
        box2.blendMode: mode
        box3.blendMode: mode
        box4.blendMode: mode
        i++
        if i = modes.length [i: 0]
    ]
    changeBlendModes()
    int: setInterval(changeBlendModes 800)
]
showFrame end