prev | index | next

MX-tweening4 - colorTransformTo
6
25
32274 bytes
1956 bytes
2006-03-16 00:00:00
2006-03-16 10:17:38
Oldes (oliva.david@seznam.cz)


Simple demonstration of colorTransformTo tweening

using Ladislav Zigo's and Moses Gunesch's precompiled "Movieclip twening prototypes 1.2.0" which you can download as a actionscript from this page: http://laco.wz.cz/tween/

(mx-tweening4.rswf)
background 255.255.255
;this is just a very simple progress bar:-)
shp_prbox: shape [fill color 0.0.0 box -5x-10 5x10]
spr_prbox: sprite [showFrame place shp_prbox show 2 Frames end]
pr: place spr_prbox at 200x160
showFrame
;Include precompiled tweening prototype
include %includes/lmc_tween_mx_1.2.0.rswf
;Make sure you skip to another frame before you do some other actions
;(it should be fixed in future)
showFrame 
bitmaps images [bmp_picture:  %bitmaps/holky.jpg]
spr_picture: sprite img_picture
pic: place spr_picture at 0x20
include %includes/txt_info.rswf

doAction [
    pr.gotoAndStop(1) ;hide the blinking cursor

    clr: make color [pic]
    clr.setTransform((make object! [ra: 100 rb: 255 ga: 100 gb: 255 ba: 100 bb: 255 aa: 100 ab: 0]))

    doSomething: func[][
        ra: random 100
        ga: random 100
        ba: random 100
        rb: random 255
        gb: random 255
        bb: random 255
        aa: 100 ab: 0
        seconds:  2
        
        info: reform ["ra:" ra "rb:" rb "ga:" ga "gb:" gb "ba:" ba "bb:" bb "aa:" aa "ab:" ab]
        pic.colorTransformTo(
            ra rb ga gb ba bb aa ab ;use like Color.setTransform
            seconds     ;Duration of tween (number).
                        ;Defaults to 2 if null or ommitted. Pass 0 to apply the change with no tween. 
            "easeOutElastic"
            0.5         ;Delay in seconds to start animation (number) defaults to 0
            doSomething ;callback function to be called when finished
                        ;(function, string, or object with scope, func, args params)
        )
    ]

    doSomething()
]

stop
showFrame
end