Flash Lite 2 |
|||
| Guide de référence du langage ActionScript Flash Lite 2.x > Classes ActionScript > Math > tan (méthode Math.tan) | |||
public static tan(x:Number) : Number
Calcule et renvoie la tangente de l'angle spécifié. Pour calculer un radian, suivez les informations qui figurent dans l'introduction à la classe Math.
Disponibilité : ActionScript 1.0 ; Flash Lite 2.0 - Dans Flash Player 4, les méthodes et les propriétés de la classe Math sont émulées à l'aide d'approximations et risquent de ne pas être aussi précises que les fonctions mathématiques non émulées que Flash Player 5 prend en charge.
x:Number - Un nombre représentant un angle mesuré en radians.
Number - Un nombre ; la tangente du paramètre x.
L'exemple suivant trace un cercle à l'aide de la constante mathématique pi, de la tangente d'un angle et de l'API de dessin.
drawCircle(this, 100, 100, 50);
//
function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):Void {
mc.lineStyle(2, 0xFF0000, 100);
mc.moveTo(x+r, y);
mc.curveTo(r+x, Math.tan(Math.PI/8)*r+y, Math.sin(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
mc.curveTo(Math.tan(Math.PI/8)*r+x, r+y, x, r+y);
mc.curveTo(-Math.tan(Math.PI/8)*r+x, r+y, -Math.sin(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
mc.curveTo(-r+x, Math.tan(Math.PI/8)*r+y, -r+x, y);
mc.curveTo(-r+x, -Math.tan(Math.PI/8)*r+y, -Math.sin(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
mc.curveTo(-Math.tan(Math.PI/8)*r+x, -r+y, x, -r+y);
mc.curveTo(Math.tan(Math.PI/8)*r+x, -r+y, Math.sin(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
mc.curveTo(r+x, -Math.tan(Math.PI/8)*r+y, r+x, y);
}
acos (méthode Math.acos), asin (méthode Math.asin), atan (méthode Math.atan), atan2 (méthode Math.atan2), cos (méthode Math.cos), sin (méthode Math.sin)