Mioplanet Documentation Center
Resources and Help
HomeProductsMioScriptJavaScriptTechNotesPHP
   Home | MioScript | num.getAngle SEARCH    

  Functions
num.abs
num.blue
num.char
num.colorToHex
num.compute
num.cos
num.fromHex
num.getAngle
num.getDistance
num.green
num.hexToColor
num.isInRect
num.not
num.random
num.red
num.rgb
num.sin
num.toHex

  MioScript Reference
> Statements
app...
browser...
dialog...
disk...
draw...
extern...
filename...
keyboard...
menu...
mio...
mouse...
num...
path...
pushButton...
reg...
RS232...
sci...
screen...
shortcut...
sound...
str...
system...
time...
var...
window...

Function
num.getAngle

Language: MioScript
Product: MioFactory


Syntax

num.getAngle(x1,y1, x2,y2)


Parameters

INTx1,y1Coordinates of the first point.
INTx2,y2Coordinates of the second point.


Return value

Number



Description

Returns the angle of a virtual line specified by two points.




MioScript Sample Code

// This sample draw a line to show where the mouse cursor is

event.load
    window.main.shape.elliptic(0,0,100,100)
    window.main.canGoOut(true)
    doevent.anim
event.end

event.anim
    &angle = num.getAngle( 
        window.main.left() + 50, window.main.top() + 50, 
        mouse.x(), mouse.y()
    ) + 90
    draw.main.rect(0,0,100,100,num.rgb(0,0,255))
    draw.main.line( \
        50,50,num.sin(&angle, 100)+50, num.cos(&angle, 100)+50,  
        2, num.rgb(255,0,0) 
    )
    draw.main.paint

    doevent.anim(20)
event.end