Skip to main content
chenjil43641795
Legend
April 5, 2021
Question

HI. [JSFL] I want to get the start and end coordinates of the brush.

  • April 5, 2021
  • 2 replies
  • 397 views

 

 

I need to get, the beginning and end of the brush.

I don't know how to get the exact point.

 

 

 

 

    This topic has been closed for replies.

    2 replies

    chenjil43641795
    Legend
    April 17, 2021

    hi.

    I just want to get the same auto-off line feature as any other animation tool.

     

    Hope to help me

     

    Charlie Bickett
    Inspiring
    September 12, 2021

    This might be a stupid question but would it not just be the first and last entries of the array of points? If the array uses a format of (x,y) for each entry then wouldn't the first and last be the litteral first and last?

     

    This method would probably only work if you have a single shape on that frame. Maybe use another property of the line to determine if it's connected? (all shapes are grouped as one element on each frame unless they're drawing objects or groups themselves)

    chenjil43641795
    Legend
    April 17, 2021

    I can find every point

    But

    How do I find the start and end points?

     

    var selPoints = new Object();
    var allBezierPoints = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0].vertices

    for ( i in allBezierPoints ) {
    selPoints[i] = { x:allBezierPoints[i].x, y:allBezierPoints[i].y }
    }
    fl.getDocumentDOM().moveSelectedBezierPointsBy({x:1, y:0});
    allBezierPoints = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0].vertices


    for ( i in allBezierPoints ) {
    if ( allBezierPoints[i].x == selPoints[i].x ) delete selPoints[i];
    }

     

    fl.getDocumentDOM().moveSelectedBezierPointsBy({x:0, y:0});

    for ( i in selPoints) {
    fl.trace ( "Point " + i + " X: "+selPoints[i].x +", Y: "+ selPoints[i].y)
    }