dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: tween max a zig zag!!!

  1. #1
    Senior Member
    Join Date
    May 2000
    Posts
    814

    tween max a zig zag!!!

    Hi all

    my code below creates a new zig zag line on publish with random node positions. I want to adapt this to tween max the nodes into positon but not sure on the syntax and way to do it. Any help/clues welcome

    rat

    PHP Code:
    import flash.display.*;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import flash.filters.DropShadowFilter;
    import flash.display.BlendMode;
    import gs.*;
    import gs.plugins.*;
    import gs.easing.*;

    import flash.display.CapsStyle;
    import flash.display.JointStyle;
    import flash.display.LineScaleMode;
    import flash.display.Sprite;
    import flash.geom.Rectangle;

    var 
    triangle:Sprite = new Sprite();
    var 
    color:uint 0xFF0044;
    var 
    lineWidth:Number 20;
    var 
    lineAlpha:Number 1.0;
    var 
    pixelHinting:Boolean true;
    var 
    scaleMode:String LineScaleMode.NORMAL;
    var 
    caps:String CapsStyle.SQUARE;
    var 
    joints:String JointStyle.MITER;
    triangle.graphics.lineStyle(lineWidthcolorlineAlphapixelHintingscaleModecapsjoints);

    var 
    triangleSide:Number Math.random()*1000;
    var 
    tri1:int Math.random()*1000;
    var 
    tri2:int Math.random()*1000;
    var 
    origX:int Math.random()*1000;
    var 
    origY:int Math.random()*1000;

    // this is standard tween max syntax
    //TweenMax.to(triangle, 0.5,{x:10,  y:10, ease:Quad.easeOut});

    //i want to smoothly animate all the lineTo below    
    triangle.graphics.moveTo(origXorigY);
    triangle.graphics.lineTo(tri1triangleSide);
    triangle.graphics.lineTo(triangleSidetriangleSide);
    triangle.graphics.lineTo(tri2tri1);

    addChild(triangle); 

  2. #2
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    Generate all the final positions in a loop, you could use Points, put these points into an array or vector.
    Place all the nodes randomly around the screen and afterwards use the Array/vector points as values in the tween max method.

    Is this want you meant?
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  3. #3
    Senior Member
    Join Date
    May 2000
    Posts
    814
    not quite sure how i would do that , i'm quite new to AS3!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center