AS mask effect

xiaoxiao2021-03-06  40

Click to browse this file (mask)

The code seems to be cumbersome, in which the part of the inside frame can be drawn.

The main steps:

First make all control points (like a method of pilot painting, scan with a radius with a triangular function), then obtain anchor coordinates according to the control point (the anchor must be connected to the two adjacent two control points. The method used in this example is the simplest method of taking the undertaking.) The last is to draw curves, Curveto (control point x, control points Y, anchor x, anchor y) to make the curve become the same, Onener refreshed, recalculate the control point before each drawing, anchor

Baseh = 10;

SM = 30;

R = 100;

DT = 2 * math.pi / sm

DOT_P = []; // Control points

DOT_M = []; // anchor points array

// Calculate data

For (i = 0; i

Dot_P [i] = {};

DOT_M [I] = {};

}

// Draw three curves with 3 MCs

THIS.CREATEEMPTYMOVIECLIP ("line_p", baseh ); // Used to draw a frame

THIS.CREATEEMPTYMOVIECLIP ("LINE_M", Baseh ); // Used to draw the inner frame

THIS.CREATEEMPTYMOVIECLIP ("LINE_M2", Baseh ); // Used to draw a smooth curve frame

// Random change

VAR J = 0

VAR K = 3

Oneterframe = function () {

J ;

// mouse follows

For (i = 0; i

R2 = r * math.abs (math.sin (j * math.pi / 180 i * i * math.pi / 6)) 70;

DOT_P [I] ._ x = r2 * math.sin (i * dt);

DOT_P [I] ._ y = r2 * math.cos (i * dt);

}

For (i = 0; i

// Curve anchor points

IF (i == 0) {

DOT_M [SM-1] ._ x = (Dot_P [SM-1] ._ x dot_p [i] ._ x) / 2;

DOT_M [SM-1] ._ y = (Dot_P [SM-1] ._ Y Dot_P [I] ._ Y) / 2;

} else {

DOT_M [I-1] ._ x = (dot_p [i-1] ._ x dot_p [i] ._ x) / 2;

DOT_M [I-1] ._ y = (DOT_P [I-1] ._ Y Dot_P [I] ._ Y) / 2;

}

}

// Clear graphics

Line_p.clear ();

LINE_M.CLEAR ();

LINE_M2.CLEAR ();

/ / Set the drawing mode

LINE_P.LINESTYLE (0,0x0033cc, 50);

LINE_M.LINESTYLE (0,0x33cc00, 50);

LINE_M2.LINESTYLE (2,0xcc3300);

// Draw graphics

For (i = 0; i

IF (i == 0) {

LINE_P.MOVETO (dot_p [i] ._ x, dot_p [i] ._ y);

LINE_M.MOVETO (Dot_M [i] ._ x, dot_m [i] ._ y);

LINE_M2.MOVETO (dot_m [i] ._ x, dot_m [i] ._ y);

LINE_M2.BEGINFILL (0xAa5500, 30);

} else {

// Draw the outer frame (linear connection control point)

LINE_P.LINETO (Dot_P [i] ._ x, dot_p [i] ._ y); // Draw the inner frame (linear connection anchor points)

LINE_M.LINETO (dot_m [i] ._ x, dot_m [i] ._ y);

// Draw a curve (curve connection anchor points)

Line_m2.curveto (dot_p [i] ._ x, dot_p [i] ._ y, dot_m [i] ._ x, dot_m [i] ._ y);

}

}

//

// Ring final closed

// Draw the outer frame (linear connection control point)

LINE_P.LINETO (dot_p [0] ._ x, dot_p [0] ._ y);

// Draw the inner frame (straight connection anchor points)

LINE_M.LINETO (Dot_M [0] ._ x, dot_m [0] ._ y);

// Draw a curve (curve connection anchor points)

LINE_M2.CURVETO (Dot_P [0] ._ x, dot_p [0] ._ y, dot_m [0] ._ x, dot_m [0] ._ y);

LINE_M2.ENDFILL ();

//

}

// the end

Click to browse this file

转载请注明原文地址:https://www.9cbs.com/read-76282.html

New Post(0)