interpolate (Point.interpolate method)

public static interpolate(pt1:Point, pt2:Point, f:Number) : Point

Determines a point between two specified points. The parameter f determines where the new interpolated point is located relative to the two end points specified by parameters pt1 and pt2. The closer parameter f is to 1.0, the closer the interpolated point will be to the first point (parameter pt1). The closer parameter f is to 0, the closer the interpolated point will be to the second point (parameter pt2).

Availability: ActionScript 1.0; Flash Player 8

Parameters

pt1:Point - The first point.

pt2:Point - The second point.

f:Number - The level of interpolation between the two points. Indicates where the new point will be, along the line between pt1 and pt2. If f=1, pt1 is returned; if f=0, pt2 is returned.

Returns

Point - The new, interpolated point.

Example

The following example locates the interpolated point (interpolatedPoint) half way (50%) between point_1 and point_2.

import flash.geom.Point;
var point_1:Point = new Point(-100, -100);
var point_2:Point = new Point(50, 50);
var interpolatedPoint:Point = Point.interpolate(point_1, point_2, 0.5);
trace(interpolatedPoint.toString()); // (x=-25, y=-25)

Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00002055.html