Jump to content
Search Community

phillip_vale

Members
  • Posts

    52
  • Joined

  • Last visited

Posts posted by phillip_vale

  1. Hi there,

     

    I am trying to populate a space with Lights at different sizes, blur amounts and alphas. I think I have acheived this.

     

    I want the final effect to be that the lights flash and use the random alpha amounts to do so. I hope this explains what I am after.

    Not sure if this is a Greensock question and sorry if it isn't.

     

    And i'm not sure if the answer lies in auto alpha, yoyo:true, repeat:-1 ???

     

    import com.greensock.TweenMax;
    import com.greensock.easing.*;
    import com.greensock.plugins.AutoAlphaPlugin;
    import flash.filters.BlurFilter;
    
    
    flashingLights = function () { 
    
    
    TheWidth = 300; // The Width of effect area -> in pixels
    Object(this).bg._width = this.TheWidth
    
    
    TheHeight = 250; // The height of effect area -> in pixels
    Object(this).bg._height = this.TheHeight
    
    
    maxLightsize = 60; // Scaling the cell
    NumOfCells = 70; // Quantity of Cells on the stage
    
    
    for (i=0; i < NumOfCells; i++) { // by using the 'for' looping sequence
    TheCell = attachMovie("Light_Cell", "Light_Cell"+i, i); // attaching the 'Light_Cell' from the library (Linkage)
    TheCell._alpha = 10+Math.random()*60; // creating random alpha value
    RandomSet = 4*Math.random()*4; // Create a random set for amount of blur
    TheBlurEffect = new BlurFilter (RandomSet,RandomSet,3); // Create variable with the filter setting (xBlur, yBlur, quality)
    TheCell.filters = [TheBlurEffect] // Applies the filter to the object named myObject
    TheCell._x = -(TheWidth/2)+Math.random()*(1.5*TheWidth); // positioning the cell on the X axis.
    TheCell._y = -(TheHeight/2)+Math.random()*(1.5*TheHeight); // positioning the cell on the Y axis.
    TheCell._xscale = TheCell._yscale = 60 + Math.random()*(maxLightsize*10); // determine the scale of the Cell
    }
    
    
    TweenMax.to(Light_Cell, 1, {_alpha: 10});
    
    
    };
    
    
    flashingLights();

     

    I should add that all of the 'lights' are being placed on the top layer when I run this going over the top of text.

     

    Thanks for you help,

     

    Phil

  2. Hi all,
     
    I am relatively new to Greensock and thought I was going well but have hit a small challenge.
    I am trying animate the effect of a volume equalizer going up and down.
     
    To keep it looking as natural as possible i wanted to vary the heights that the levels rise to.
    However, when I run the below code it picks the last number that the function generates and then doesn't 'refresh' a new value when the loop repeats. Is there a way to call randomRange everytime the tween repeats?
     
    function randomRange(min:Number, max:Number):Number {
        var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
        return randomNum;
    }
    for (var i = 0; i < 1; i++) {
        var n:Number = randomRange(-27, -72) // Audio levels between these 2 numbers.
        trace(n);
    }
    
    
    TweenMax.to(Object(this).main.window1.shade, .2, {_y:n, yoyo:true, repeat:-1, delay:.2});
    TweenMax.to(Object(this).main.window2.shade, .2, {_y:n, yoyo:true, repeat:-1, delay:.3});
    TweenMax.to(Object(this).main.window3.shade, .2, {_y:n, yoyo:true, repeat:-1, delay:.4});

    Thanks for any help that is given,

     
    Phil :)

     

×
×
  • Create New...