Jump to content
Search Community

GusAugust last won the day on June 14 2015

GusAugust had the most liked content!

GusAugust

Members
  • Posts

    9
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by GusAugust

  1. Timeline tlA translates a rectangle horizontally three times, with constant acceleration across all three.
    When tlA completes, tlB is supposed to translate the rectangle once vertically.
    The sequence works properly only if I provide a position value for tlB. The value 2.5 was determined by trial and error.
    The issue remains if they are made children of a parent timeline.

    The repeat value will be a variable provided by the user. This means that the position value for tlB will vary and needs to be determined in code.

    How can the position value be determined elegantly?

    Thank you,
    Gus

    var rect:Sprite = new Sprite;
    rect.graphics.beginFill(0xFF0000);
    rect.graphics.drawRect(50, 75, 50, 50); // x, y, width, height
    rect.graphics.endFill();
    addChild(rect);
    
    var tlA:TimelineMax = new TimelineMax();
    var tlB:TimelineMax = new TimelineMax();
    TweenMax.to(tlA, 5, { timeScale:20 } );
    tlA.repeat(2);
    tlA.to(rect, 5, { x:400 } );
    tlB.to(rect, 5, { y:200}, 2.5 ); // 2.5 is trial and error value
    
    
  2. This code is copied from this page on your website: http://greensock.com/docs/#/HTML5/GSAP/TimelineMax/recent/

    (Semicolons at the end of lines 3 and 4 were removed.)

    The page is HTML5 documentation but I'm using AS3.

    tl = new TimelineLite();
    tl.to(e1, 999, {x:100, repeat:5}) //very long tween
    .to(e2, 1, {y:200}, 0.5) //insert this tween at 0.5 seconds (toward the beginning of the timeline)
    .to(e3, 1, {scaleX:2}, tl.recent().endTime() + 3) //inserts the new tween 3 seconds after the e2 tween which was added most recently.
    

    The compiler reports this error, pointing to tl.recent() in the last line:

    Call to a possibly undefined method recent through a reference with static type com.greensock:TimelineLite

    TimelineLite, TweenLite, and core.Animation classes are all imported.

    GreenSock is current version.

    FlashDevelop is the development environment.

     

    I don't understand.

  3. This works properly - a stand-alone tween:

    TweenMax.to(rect, 2, {x:200, repeat:1, yoyo:true});
    

    This does not - the same tween in a timeline - the initial translation works, but no repeat:

    tl = new TimeLineMax();
    tl.to(rect, 2, {x:200, repeat:1, yoyo:true})
    

    I know that the timeline can be set to repeat and yoyo, but I just want a single tween in the timeline to repeat and yoyo.

     

    Thanks, Gus

  4. Why does the rendering work properly but the values after the tween are not correct?

    var rect:Sprite = new Sprite;
    rect.graphics.beginFill(0xFF0000);
    rect.graphics.drawRect(0, 0, 20,20); // x, y, width, height
    rect.graphics.endFill();
    addChild(rect);
    
    trace(rect.x, rect.y); // 0 0 correct
    
    rect.x = rect.y = 100;
    trace(rect.x, rect.y); // 100 100 correct
    
    TweenMax.to(rect, 1, { x:200, y:200 } ); // renders properly on stage
    trace(rect.x, rect.y); // 100 100 NOT CORRECT should be 200 200
    
    
×
×
  • Create New...