• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Line following two constraints

New Here ,
Apr 26, 2017 Apr 26, 2017

Copy link to clipboard

Copied

Hello

I'd like to create a line that follows two constraints:

1. its pivot point is the line end which is fixed on a star

2. the second end follows a path - an arc of a circle

additionally, a small circles follows the same arc in the same pace.

PATH.png

thank you

Views

111

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 26, 2017 Apr 26, 2017

Copy link to clipboard

Copied

LATEST

var p:MovieClip = new MovieClip();

addChild(p);

var ctr:Point = new Point(300,300);

var perimeterPt:Point = new Point();

var rad:int = 200;

var angle:int = 270;

var fac:Number = Math.PI/180;

var t:Timer = new Timer(30,0);

t.addEventListener(TimerEvent.TIMER,drawF);

t.start();

function drawF(e:TimerEvent):void{

    with(p.graphics){

        clear();

        lineStyle(0)

        perimeterPt.x = ctr.x+rad*Math.cos(angle*fac);

        perimeterPt.y = ctr.x+rad*Math.sin(angle*fac);

        moveTo(pivot_mc.x,pivot_mc.y);

        lineTo(perimeterPt.x,perimeterPt.y);

        circle.x = perimeterPt.x;

        circle.y = perimeterPt.y;

        angle++;

    }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines