For an old project I did this 'Gradient Tween Editor' which might be a good
starting point for what you want to do:
http://motiondraw.com/md/as_samples/t/gradientTween/asynchronousTween.html

Here's an example (on the right-hand side) that tweens from one gradient to
another over time:
http://motiondraw.com/md/as_samples/t/gradientTween/asynchronousTween.html
On the left is the same tween, but not over time but from top to bottom -
the first horizontal, 1 pixel high stripe corresponds with the 'first frame'
of the tween on the right. The stripe at the bottom corresponds with the
'last frame'.

See the code below!

hth
--------------
Andreas Weber

// for the class see:
//
http://motiondraw.com/md/as_samples/t/gradientTween/gradientTweenEditor.html

import com.motiondraw.GradientTween
this.createEmptyMovieClip('gradient_mc', this.getNextHighestDepth())

gT = new Object();
gT.colors1     = [10092288,153,65331];
gT.alphas1     = [100,100,100];
gT.ratios1     = [0,208,255];
gT.rotation1   = 0;

gT.colors2   = [13052923,16750848,2266464];
gT.alphas2   = [100,100,100];
gT.ratios2     = [0,130,255];
gT.rotation2   = 0;

gT.gradModeRotation   = 'linear';

gT.gradWidth   = 250;

// Note: in the asynchronous view
// the gradHeight is the number of frames
gT.gradHeight  = 250;


gT.gradient_mc =_level0.gradient_mc;
gT.draw = true;// draws the 'synchronous' tween

var myGrad:GradientTween = new GradientTween(
    gT.colors1,
    gT.alphas1,
    gT.ratios1,
    gT.rotation1,

    gT.colors2,
    gT.alphas2,
    gT.ratios2,
    gT.rotation2,

    gT.gradModeRotation,

    gT.gradWidth,
    gT.gradHeight,
    gT.gradient_mc,
        gT.draw);


// draws the 'asynchronous tween'
var i = 0;
var c = this.createEmptyMovieClip('canvas', this.getNextHighestDepth());
c._x = 300;


this.onEnterFrame = function(){
        var mg = myGrad.multiGradient[i];
        mg.r = mg.rotation;

        c.beginGradientFill(mg.gradModeRotation, mg.colors, mg.alphas,
mg.rotation, mg.matrix);
        c.moveTo(0, 0);
        c.lineTo(gT.gradWidth, 0);
        c.lineTo(gT.gradWidth, gT.gradHeight);
        c.lineTo(0,  gT.gradHeight);
        c.lineTo(0, 0);
        c.endFill();
                        
        i++;
        
        if(i ==  gT.gradHeight + 1){
                i = 0;
        }
}




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Scott
Brantley
Sent: Freitag, 15. Dezember 2006 20:59
To: Flashcoders mailing list
Subject: [Flashcoders] dynamically tween gradient


I'm building a website. The background for each of the sections of the site
is a different colored linear gradient. Does anyone have any ideas on how to
build a class, prototype or series of functions that will dynamically change
the background gradient from one colored gradient to another over a period
of time? If anyone has any pre-built code and wouldn't mind sharing I will
greatly appreciate it!

Thanks

 

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to