Skip to main content
kili
Known Participant
April 15, 2017
Question

on AS3 - Erase a Bezier curve.

  • April 15, 2017
  • 1 reply
  • 338 views

on AS3 - I would like to animate a Bezier curve changing Ends and Control points on an enterframe sequence. Ideally I would erase the previous curve and draw the new one on each enterframe. How do I erase the previous one? Is there other methode?

    This topic has been closed for replies.

    1 reply

    Legend
    April 15, 2017
    kili
    kiliAuthor
    Known Participant
    April 16, 2017

    Thank you. This is a portion of my code. If I remove the clear() line, the screen fills up with Beziers. If I leave the clear() line, the page remains blank. It looks like once the clear() line is there I can not draw on the sprite any more.

    var yy:int= 10;

    var ctrlPt:int = 0;

    addEventListener(Event.ENTER_FRAME, onEnterFrame);

    function onEnterFrame(event:Event):void

    {

    yy++

    ctrlPt = yy + 80;

    sp.graphics.clear();

    sp.graphics.moveTo(200,yy);

    sp.graphics.curveTo(300,ctrlPt,400,yy);

    addChild(sp);

    }

    Legend
    April 16, 2017

    Why are you adding your sprite as a child every single frame?