Created
May 30, 2012 02:16
-
-
Save abarth500/2832860 to your computer and use it in GitHub Desktop.
receiver on JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//メッセージはココで受信 | |
//チャンネル削除 | |
msg = msg.substring(msg.indexOf(":")+1); | |
//カンマで分けて配列へ | |
fields = msg.split(","); | |
//注:サーバから来たデータは文字列として扱われているため、 | |
//数値を送った場合使用時はparseInt等で数値化する。 | |
if(X > -1){ | |
ctx.strokeStyle = 'rgb(254, 254, 254)'; | |
ctx.beginPath(); | |
ctx.moveTo(X, Y); | |
ctx.lineTo(parseInt(fields[0]), parseInt(fields[1])); | |
/* 三角形を線で描画 */ | |
ctx.stroke(); | |
} | |
X = parseInt(fields[0]); | |
Y = parseInt(fields[1]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment