Newbie / how was this done? animated stroke

My favorite DPS magazine has this beautiful animated stroke that I am showing below in these iPad screen captures. The stroke starts from upper left corner and progresses up until to lower right. This is DPS and I presume this animation is made in Flash before becoming a DPS html overlay, so I drawed a couples of black lines in Flash with several white rectangle tweens progressively covering the line in order to recreate that effect. That does not work, my SWF ignores the timeline and triggers all tweens at the same time, ruins the effect.
I am not a Flash guy, but do you people know if Flash is the easiest to create this effect?
Many thanks,

First, you need to get handle of AS3 drawing API and geometry/math capabilities.
Here is the link to Graphics class documentation:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics. html
Here is the link to Point API docs:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/geom/Point.html
Math is, well, the same as anywhere else.
In JavaScript you will need to get knowledge of its API as well - it is very similar because AS3 and JavaScript are siblings.
Here is a code that I commented as thoroughly as I could:
stop();
import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
* Shape which is used to draw line into.
* Basically line drawing itself.
var animatedLineOverlay:Shape;
* Instance of animatedLineOverlay.graphics
* This variable is created to be reused
var overlayGraphics:Graphics;
// array of points between which to draw line
var overlayPoints:Array;
// x and y postions of line drawing
var overlayMargin:Number = 30;
* Used to kepp reference to current start and end points
* between which line is being drawn
var currentPoints:Object;
* Next point to which draw line in the animation.
* Declare here so it can be reused.
var nextPoint:Point;
* Line straight segmen starting point.
var sPoint:Point;
* Line straight segment end point
var ePoint:Point;
* Anngle under which to draw line segment
var angle:Number;
* Line draw speed
var speed:Number = 8;
* How far to advance line animation in a single frame along x
var advanceX:Number;
* How far to advance line animation in a single frame along y
var advanceY:Number;
init();
* Inititalizes entire thing by calling specialized functions
function init():void
    makeBackground();
    definePoints();
    makeOverlay();
    startAnimation();
* Starts line animation by adding ENTER_FRAME event listener
function startAnimation():void
    addEventListener(Event.ENTER_FRAME, drawLine);
* ENTER_FRAME event handler
* @param    e
function drawLine(e:Event):void
    // if no currentPoints defined - go through the logic
    if (!currentPoints)
         * since we shorten overlayPoints while animating line
         * whyen array is empty - stop animation
        if (overlayPoints.length == 0)
            // stop animation
            removeEventListener(Event.ENTER_FRAME, drawLine);
            // calling return will effectively exit drawLine function
            return;
        // get point to process by extracting first element in the array
        currentPoints = overlayPoints.shift();
        // if element contains color property - change line color
        if (currentPoints.lineColor)
            overlayGraphics.lineStyle(1, currentPoints.lineColor, 1, true);
        // get start and end points
        sPoint = currentPoints.start;
        ePoint = currentPoints.end;
        // calculate angle between the points
        angle = Math.atan2(ePoint.x - sPoint.x, ePoint.y - sPoint.y);
        // calculate how far line needs to advance along x/y based on the angle
        advanceX = speed * Math.sin(angle);
        advanceY = speed * Math.cos(angle);
        // move line to startgin position
        overlayGraphics.moveTo(sPoint.x, sPoint.y);
        // starting point position
        nextPoint = new Point(sPoint.x, sPoint.y);
    // advance drawing coordinates
    nextPoint.x += advanceX;
    nextPoint.y += advanceY;
    // add to line segment nextPoint coordinates
    overlayGraphics.lineTo(nextPoint.x, nextPoint.y);
     * if the lates drawing did not get to the exact target point
     * add the difference
    if (Point.distance(ePoint, nextPoint) <= speed)
        // add the difference
        overlayGraphics.lineTo(ePoint.x, ePoint.y);
         * nullify currentPoints so that on the next frame
         * funciont exectures first conditional
        currentPoints = null;
* Creates data for usage in animation.
* Points coordinates are arbitrary.
function definePoints():void
    // use this variables to make drawing dynamic - based on overall application dimensions
    var overlayWidth:Number = stage.stageWidth - overlayMargin * 2;
    var overlayHeight:Number = stage.stageHeight - overlayMargin * 2;
    overlayPoints = [];
     * each array element will be an Object
     * each Object will have two properties start and end
     * which represent points at which, naturally start and end line segment
     * points values are totally arbitrary - use your imagination
    overlayPoints.push({start: new Point(0, 0), end: new Point(0, overlayHeight / 6)});
    overlayPoints.push({start: new Point(0, overlayHeight * .5), end: new Point(0, overlayHeight)});
    overlayPoints.push({start: new Point(0, overlayHeight), end: new Point(overlayWidth / 8, overlayHeight)});
    overlayPoints.push({start: new Point(overlayWidth / 8, overlayHeight), end: new Point(overlayWidth / 6, overlayHeight - 50)});
    overlayPoints.push({start: new Point(overlayWidth / 6, overlayHeight - 50), end: new Point(overlayWidth * .5, overlayHeight - 50)});
    // this element also has color property - to change line color at this segment
    overlayPoints.push({start: new Point(overlayWidth * .5, overlayHeight - 50), end: new Point(overlayWidth - 20, overlayHeight - 50), lineColor: 0xFFFFFF});
    overlayPoints.push({start: new Point(overlayWidth - 20, overlayHeight - 50), end: new Point(overlayWidth - 20, overlayHeight - 100)});
    overlayPoints.push({start: new Point(overlayWidth - 20, overlayHeight - 100), end: new Point(overlayWidth, overlayHeight - 150)});
    overlayPoints.push({start: new Point(overlayWidth, overlayHeight - 150), end: new Point(overlayWidth, overlayHeight - 200)});
* Creates line drawing plain
function makeOverlay():void
    // instantiate
    animatedLineOverlay = new Shape();
    // gain reference to the graphics API
    overlayGraphics = animatedLineOverlay.graphics;
    // define line properties
    overlayGraphics.lineStyle(1, 0, 1, true);
    overlayGraphics.beginFill(0x000000);
    // draw initial rectangle at the top/left
    overlayGraphics.drawRect(0, 0, 80, 10);
    overlayGraphics.endFill();
    // position drawing plain at its margin
    animatedLineOverlay.x = animatedLineOverlay.y = overlayMargin;
    addChild(animatedLineOverlay);
* Makes applpication background.
function makeBackground():void
    graphics.beginFill(0xFF8040);
    graphics.drawRect(0, 0, stage.stageWidth * .5, stage.stageHeight);
    graphics.endFill();
    graphics.beginFill(0x0070DF);
    graphics.drawRect(stage.stageWidth * .5, 0, stage.stageWidth * .5, stage.stageHeight);
    graphics.endFill();

Similar Messages

  • How was this "flash" animation done?

    How was this "Flash" animation done?
    http://www.templatemonster.com/flash-templates/15812.html
    There is a "flash" that goes down the sholder of a man in this Flash intro page. It is a series of jpg images. Do you know how this can be done or which program was used? I want to chage the page of it.
    Thanks, Steve

    Hi Steve,
    I'm pretty sure it's done with a mask. You have the man picture layer and the border layout masked by a symbol (maybe a square or rectangle) above it.
    If you want to know how to use mask in Flash, just ask Google. There is a bunch of tutorial on the web.
    Hope it's a good start for you !
    Martin
    http://www.martinc.biz

  • How was this done - movable shape that changes percentage

    I saw a presentation that had a pointer that the user could smoothly drag along a horizontal line, and when moving the pointer, the percentage underneath the pointer automatically changed. The pointer can be moved horizontally along the line, but cannot be moved vertically.
    How was this done --- Is this something that can be accomplished in Captivate, or was it done in another program and inserted into Captivate? See two examples below.

    AFAIK this can be done in Captivate, if you include some widgets (thinking about the Slider component widget of InfoSemantics). But widgets are not compatible with HTML5 output.
    For HTML5, Edge Animate could produce that kind of interactivity as well, and you can embed an OAM package in Captivate, using the App packager in CP7, and right away in CP8.
    Lilybiri

  • How was this done (Stacking)?

    Hello!
    How was this effect done? http://www.riccardomagherini.com/fine_art/, I think I know how it is finished in PS, but how do you shoot this?

    Hi Alex,
    this tool is usually called the Blur or soft-focus effect (translated from my German PS). Many programs offer this brush for applying to the effect. Often you can select the photo, create a soft edge selection and then make the selection using filter blurred or you yourself blur some of the image areas.
    And we have the tool "Unsharp Mask". For this purpose, only the original image and a blurred version are required. The layer structure, however, shows good results only if your program supports 32-bit color depth, like Photoshop.
    On the other hand, I'm sure you will get better explanations, by asking Riccardo Magherini himself at http://www.riccardomagherini.com/fine_art/contact/. I'm sure you will get answers marked of a professional competence and responsibility.
    Hans-Günter

  • Transitions... how was this done?

    http://www.lounginrecordings.com/index_flash.html
    notice the smooth transition from section to section... as if
    the whole site is one continuous movie? how is this handled? is
    this a "levels" and "root" thing (something i know nothing about
    yet)?
    thanks.

    joeq wrote:
    > <a target=_blank class=ftalternatingbarlinklarge
    > href="
    http://www.lounginrecordings.com/index_flash.html
    >
    > notice">
    http://www.lounginrecordings.com/index_flash.html
    >
    > notice</a> the smooth transition from section to
    section... as if the whole
    > site is one continuous movie? how is this handled? is
    this a "levels" and
    > "root" thing (something i know nothing about yet)?
    These type of transitions are the easiest. Let me explain how
    it works.
    From frame 1 to 10 you have some motion tween - fading in.
    Than from frame 10 to 20 fading out, or motion out, like in
    your example motion out.
    On that 10th frame there is an action that picks a variable
    and go to frame in a
    movie clip accordingly. All the button does is sets variable
    and play
    the timeline, than timeline frame 10th action call the
    content and while
    the fading is done, the content has been changed.
    Button :
    on (release) {
    _root.pa = 2;
    _root.play();
    than frame 10
    MovieClipWithContent.gotoAndPlay ("p" + _root.pa);
    Inside MovieCLipWithContent make labels p1 p2 p3 p4 p5 p6 p7
    and so on....
    Regards
    Urami
    Happy New Year guys - all the best there is in the 2006
    <urami>
    http://www.Flashfugitive.com
    </urami>
    <web junk free>
    http://www.firefox.com
    </web junk free>

  • How was this done?

    see the effect on the name
    I'm referring to the name coming in on the top left, you will
    see it skewed then swing out like a gate and stop
    I tried every which way to skew and scale to get a transition
    to look like this and I find that the skew allows you to pull (lets
    say) the left corner up while holding alt but the shape never
    conforms. I tried doing it with text, breaking up the text,
    creating a graphic and a movie symbol of the text and still can't
    do this.
    No luck finding any tutorial or video on it either
    I'm on a Mac using CS3
    Any help?

    Sorry, I thought I had the answer but I was wrong. This
    effect was created one of two ways, in Illustrator or After
    Effects. I have Illustrator CS3 and found out how to export
    animations as swfs . So in my case I would have to create the text
    effect and export as an swf (frame by frame animation) but this is
    where I need help. I cannot find a way to export just a text effect
    and drop it in an existing fla? Only way I could think of was using
    loadMovie but there has to be a different way. I went ahead and
    used a Flash decompiler and opened the swf of the link in the
    original post with the text effect in it. In the fla the text
    effect is in a layer with frame by frame animation inside a
    movieclip on the main timeline. So how did they export an swf of
    this text effect and get the effect into a movieclip since
    Illustrator only exports swf's not fla's?
    if I'm unclear in my explanation I'd be glad to clarify it.

  • How was this done? Fullscreen mode?

    How did they do the fullscreen mode?
    http://www.sasokos.com
    Thanks a lot!

    type 'fullscreen' into flash help search and click on the
    first item under Programming ActionScript 3.0, 'Setting Stage
    Properties' and look at 'Working with full-screen mode'.
    Or have a look at adobe articles, for example,
    here.

  • How was this SWF created?

    Hi. How was this video created? It displays the name "Joe
    Schmoe" throughout; this could be any text, by the way.
    http://www.cnnbcvideo.com/?nid=lRbWr4wkznBWkEcCraq91zQ5Njc2NA--&referred_by=14859716-SGF0a 4x
    What software would you need? Any examples of how one might
    create this? Thanks.
    [Please note: I'm not responsible for the political content
    of the video; I work for a non-profit who would like to create a
    video like this for fundraising. Thanks.]

    It could be one of the effects in Swish.
    "xJaNx" <[email protected]> wrote in message
    news:e5n44s$le9$[email protected]..
    >i was just curious how was this effect created are there
    online tutorials
    >
    > <a target=_blank class=ftalternatingbarlinklarge
    > href="
    http://www.olmosphoto.com/v2/index.html
    >
    > the">
    http://www.olmosphoto.com/v2/index.html
    >
    > the</a> letters are scrambled and then change so
    fast in the logo to the
    > correct stance
    >
    > how is that done ?
    >
    > can someone help
    >

  • After installing OS X Yosemite 10.10.2 -  I get this when I try to open Illustrator " To open "Adobe Illustrator CS6" you need to install the legacy SE6 runtime." I can not get seem to do this, how is this done?

    After installing OS X Yosemite 10.10.2 -  I get this when I try to open Illustrator “ To open “Adobe Illustrator CS6” you need to install the legacy SE6 runtime.” I can not get seem to do this, how is this done?

    Robert,
    It seems to be enough to create empty folders at “/System/Library/Java/JavaVirtualMachines/1.6.0.jdk” and “/System/Library/Java/Support/Deploy.bundle”, to make Illustrator use Jave SE 8 as it should.
    This way to get round the legacy JAVA requirement was presented by Kals in post #7 in this thread:
    https://forums.adobe.com/thread/1637908

  • Is it possible to downgrade a new Mac Mini from OSX 10.7 to OSX 10.5? If so, how is this done?

    Is it possible to downgrade a new Mac Mini from OS X 10.7 to OSX 10.5? If so, how is this done?

    No. You can't install earler versions of the OS than that with which (any) Mac was originally delivered.
    If you REALLY want to investigate this, read this thread....
    https://discussions.apple.com/thread/3209335?tstart=0

  • I have a column that is grouped and looks to be duplicated. How is this done?

    The example here is what is done. I have this first part, the part highlighted in dark blue that is grouped. Then it has been duplicated 12 times. When I highlight any part of it the group is selected. How is this done? How do I increase the times it was duplicated?

    See the layers panel and the appearance panel. If yoz can't make sense of it, show it here.
    Might be the transform effect.

  • I have a POP Verizon e-mail address on my iMac and use Mac Mail v3.6. I recently purchased a MacBook Pro and would like to sync the e-mail so that they're the same on each machine. I've learned I must switch to IMAP...how is this done?

    I have a POP Verizon e-mail address on my iMac and use Mac Mail v3.6. I recently purchased a MacBook Pro and would like to sync the e-mail so that they're the same on each machine. I've learned I must switch to IMAP...how is this done? Please dumb it down as best you can. I have this great fear that I'll lose all my e-mails in the process.

    I have a POP Verizon e-mail address on my iMac and use Mac Mail v3.6. I recently purchased a MacBook Pro and would like to sync the e-mail so that they're the same on each machine. I've learned I must switch to IMAP...how is this done? Please dumb it down as best you can. I have this great fear that I'll lose all my e-mails in the process.

  • I want to load my emails from an old mac to a newer imac? How is this done?

    I want to load my emails from an old G5 mac to a newer I-mac? How is this done?

    Are you positive the old iMac is a G5, please click about this Mac and tell us what CPU it has.
    This article will help you get started https://discussions.apple.com/docs/DOC-2295

  • I made a photo book in iPhoto and would like to transfer the book to my iPhoto on other macs and iPad.   How is this done and can it be synced between devices like photo stream.

    I made a photo book in iPhoto and would like to transfer the book to my iPhoto on other macs and iPad.   How is this done and can it be synced between devices like photo stream?

    You can create a Quicktime movie slideshow of the book's pages and share that. Here's how to get your book into an iPhoto slideshow and then export as a Quicktime video:
    1 - While viewing the book type Command+P to start the print process.
    2  - click on the PDF button and select "Save PDF to iPhoto".
    Note:  If you don't have any of those options go to Toad's Cellar and download these two files:
    Save PDF to iPhoto 200 DPI.workflow.zip
    Save PDF to iPhoto 200 DPI.workflow.zip
    Unzip the files and place in the HD/Library/PDF Services folder and reboot.
    3 - select either of the files above (300 dip is used for photos to be included in a book that will be ordered).
    4 - in the window that comes up enter an album name or select an existing album and hit the Continue button.
    That will create a 200 or 300 dpi jpeg file of the item being printed and import it into iPhoto. Immediately select all of the photos in the new album and sequentially renumber them as "Page  " using the Batch Change ➙ Title to Text with the option to add a sequential number to each title.  This is to let you put the pages back in the correct order in the event they get sorted incorrectly.
    Now you can proceed as follows: create the slideshow in iPhoto and export it out of iPhoto as a QT movie file via the Export button in the lower toolbar.  Select Size = Medium or Large (480p with iPhoto 9),
    Happy New Year

  • READER IX opening equipment PDF to perform an internal Word SEARCH. How is this done?

    Using Reader IX to open a Service Manual and then a Word SEARCH. How is this done?

    thanks....
    In a message dated 8/17/2014 9:00:29 P.M. Pacific Daylight Time, 
    [email protected] writes:
    READER  IX opening equipment PDF to perform an internal Word SEARCH. How is
    this  done?
    created by ashutoshmehra (https://forums.adobe.com/people/ashutoshmehra) 
    in Adobe Reader - View the full  discussion
    (https://forums.adobe.com/message/6649441#6649441)

Maybe you are looking for