Random
Using the program to generate the canopy randomly, it is explained that the DP value in the component "tree" controls the depth of the branch's growth, the higher the number of points, but note that a DP over 13 can cause Flash to run slowly.
Effect:
I explain the usefulness of some of the code to the last frame of the "right Fork" code.
Stop ();
if (dp>0) {//DP is used to control the growth of the branch, the branch will not grow apart when dp<0.
Here is the code for the new tree above the front.
K=random (4) +1; K is used to select the tree shape, which is straight, left fractal, right fractal and Middle Branch.
_parent.attachmovie ("Sz_0" +k, "sz" +_PARENT.DP,_PARENT.DP); To build a new branch.
lik=_parent["sz" +_PARENT.DP]; Lock the branch with Lik to facilitate later control
rp=this._rotation+0; The RP is the new branch's root coordinates (the yellow dots) relative to the current angle of the branch's root coordinate (blue dots), which affects the coordinates of the new tree that will be generated. This is considered in polar coordinates because the first point of the branch is just above it, so the correction value is 0.
lp=62; The distance of the new dendritic root coordinates in this direction of the RP.
_parent.dp++; Deep control, you don't have to consider
Lik._x=this._x+lp*math.sin (Rp/180*math.pi) *scal/100;
Lik._y=this._y-lp*math.cos (Rp/180*math.pi) *scal/100;
The above calculation is the new branch of the root coordinates, the specific meaning of the polar coordinates and coordinate conversion method. The scal inside is the zoom of the branch. It will have an effect on the coordinates.
Lik.scal=this.scal*_parent.jian; The new branch's zoom is smaller than the current branch's zoom degree.
lik._xscale=lik.scal;
lik._yscale=lik.scal;
Lik._rotation=rp+random (30)-15;; The angle of the new branch is the current branch angle to the left and right each 15 degrees randomly swinging. (just 15 to +15 degrees)
Lik.dp=this.dp-1; The growth of the new branch-1;
Here's the code for the new tree on the right.
K=random (4) +1;
_parent.attachmovie ("Sz_0" +k, "sz" +_PARENT.DP,_PARENT.DP);
lik=_parent["sz" +_PARENT.DP];
rp=this._rotation+20; Note that the 20 degree angle is the polar coordinate angle of the new branch.
lp=52; 52 is the distance
_parent.dp++;
Lik._x=this._x+lp*math.sin (Rp/180*math.pi) *scal/100;
Lik._y=this._y-lp*math.cos (Rp/180*math.pi) *scal/100;
Lik.scal=this.scal*_parent.jian;
lik._xscale=lik.scal;
lik._yscale=lik.scal;
Lik._rotation=rp+random (30) +5;; Angle will be slightly to the right, so the current angle is increased between 5 and 35
Lik.dp=this.dp-1;
}
Of course the administrator also mentioned that this is fractal.