prev | index | next

SWF5-Snow
5
30
783 bytes
1208 bytes
2003-12-28 00:00:00
2003-12-28 15:01:14
oldes (oliva.david@seznam.cz)


Falling snowflakes example

(swf5-snow.rswf)
background 153.204.255
shp_snowflake: shape [
    fill color #FFFFFF circle 3
]
spr_snowflake: Sprite shp_snowflake
exportAssets [spr_snowflake "snowflake"]

es: EmptySprite
spr_Snow: place es [
    at 0x0
    actions [
        load [
            no: 50 ;snow number
            width: height: 320
            for i 0 no 1 [
                o: make object! [
                    dx: 0
                    _x: Math.random() * width
                    _y: Math.random() * height
                    am: Math.random() * 2
                    ;set step variables:
                    stx: 0.02 + Math.random() / 10
                    sty: 0.7  + Math.random()
                ]
                o._xscale: o._yscale: 30 + random 70
                this.attachMovie("snowflake" ("snowflake" add i) i o)
            ]
        ]
        enterFrame [
            for i 0 no 1 [
                snowFlake: eval(("snowflake" add i))
                tellTarget snowFlake [
                    _y: _y + sty
                    if _y > _parent.height [
                         _x: Math.random() * _parent.width
                         _y: 0
                        stx: 0.02 + Math.random() / 10
                        sty: 0.7  + Math.random()
                    ]
                    dx: dx + stx
                    _x: _x + am * (Math.sin(dx))
                ]
            ]
        ]
    ]
]
showFrame
end