1、安裝包:ZigSOpenNI2、SimpleOpenNI丟Processing3、安裝Kinect SDK 1.7
2、以Processing 2.1.2版本測試
<a href="javascript:form1.submit();"> <img src="img.jpg"</a>
<a href="javascript:form1.reset();"> <img src="img.jpg"</a>
document.form1.disabled = true / false;
讀取表單所有名稱
form1.elements.lengthform1.elements[i].name
var num = "0123456789"var str = form.id.value;for(i=0;i<str.length;i++){ if(num.indexOf(str.charAt(i))== -1)}
<form> <label for="Namebox" accessKey="N"><u>N</u>ame:</label> <input type="text" id="Namebox"></form>
<input type="text" id="txID">form.txID.focus();
form.ID.focus();form.ID.select();
<input type="text" value="HERE" onMouseOver = "this.style.color = 'red' ">
<input type="text" value="HERE" onMouseOver = "this.style.background= 'red' ">
<input type="text" value="HERE" onMouseOver = "this.style.borderColor= 'red' ">
onKeyPress = "autoWidth()"str = form.ID.value;if(str.length !=0){ form.ID.size = str.length;}
form.Id.style.textAlign = left/center/right;
<form id="fm1_Id" action="http://www.google.com/search"> <input name="q" id="searchWord" > <br> <input type="submit" value="搜尋"></form>
<form id="form1"><input name="sex" type="radio" checked>男<input name="sex" type="radio" >女</form>
form1.sex[0].checked form1.sex[1].checked
form1.id[i].checked
<input type="checkbox" id="ch1"><label for="ch1" > 標籤 </label>
<form id="form1"><select id="sel1" onChange="get()"><option value="第一項">第一項</option><option value="第二項">第二項</option><option value="第三項">第三項</option></form>
form1.sel1.value
form1.sel1.selectedIndex
<select id="sel1" multiple>form.id[i].selected // 看看有沒有被選到form.id[i].value
open()取代window.loction()open(http://www.google.com);
<form id="form2" enctype="multipart/form-data" ><input type="file" id="file"> <input type="button" onClick="get()" value="FileName"></form>
form2.id.value
取得檔案路徑後,用split()將路徑以“\”切割,再存入陣列中,最後取出陣列的最後一項在JavaScript中插入一個反斜線必須用雙斜線表示。var fName = form2.id.value;var fileName = new Array();fileName = fName.split("\\");fileName[fileName.length-1]
取得檔案路徑後,用split()將路徑以“.”切割,再存入陣列中,最後取出陣列的最後一項
fileName = fName.split(".");
先判斷是不是圖檔
extname.toUpperCase() =="JPG"pic.src = fileName; //完整路徑
先建立圖片物件,並為圖片物件指定來源,再使用物件屬性取得size
img = new Image();
img.src = fileName;
size = img.fileSize / 1024 ; //將圖片大小轉成KB
img.widthimg.height
document.body.backgronund = imgURL;
<body onLoad="alert('歡贏')" onUnload="alert('謝謝')">
<input type="button" onClick="alert('單擊')"><input type="button" onDbClick="alert('雙擊')">
function getButton(){ switch(event.button) { case 0 : alert("左鍵");break; case 1 : alert("右鍵");break; case 2 : alert("中鍵");break; }}document.onmousedown = getButton; //監聽器
<body onmousedown="alert('點擊')">
<body onContextMenu="alert('NO') ; return false" >
<marquee direction="up" onMouseOver="this.stop()"onMosueOut="this.start()">
function getMouse(){ event.x; event.y;}document.onmousemove = getMouse;
<img src="img1" onMouseOver = " this.src = ' img2 ' " onMouseOut = " this.src = ' img1 ' " >
picID.style.visibility = 'visible'picID.style.visibility = 'hidden'
function getkeyCode(){ asc = event.keyCode; key = String.fromCharCode(asc);}document.onkeydown = getkeyCode; // 可以取得所有按鍵,但無法分辨大小寫document.onkeypress = getkeyCode; //可分辨大小寫
window.loaction.href = "www.google.com";
asc = event.keyCode;key = String.fromCharCode(asc);str += key;txt.innerHTML = str;document.onkeypress = showkey;
<div onMouseOver = "this.style.cursor='hand'">手形指標</div>
靜態指標:this.style.cursor='url(img.cur)'動態指標:this.style.cursor='url(img.ani)'
- 登入密碼驗證
看網頁原始碼就破解var password = prompt("請輸入密碼","");
陣列 = document.all.tags("A");
alert("HI你好");
ret = confirm("可以加你朋友嗎"); //ret回傳值(true/false)
可以顯示一個對話方塊,此對話方塊是另一個網頁的內容
features = "dialogWidth:300px;dialogHeight:200px;status=no"; // 設定對話方塊CSS
showModalDialog("dialog.html",window,features);
不同於showModalDialog的地方是,顯示對話方塊後還可以同時操作原本後面的網頁視窗
features = "dialogWidth:300px;dialogHeight:300px;status-no";
showModelessDialog(dialog.html,window,features);
var width = document.body.clientWidth;
var height = document.body.clientHeight + 125; //瀏覽器網址,工具列...
var width = screen.width;
var height = screen.height;
一但改變視窗大小就觸發<body> onResize事件
<body onResize="window.resize(400,300)">
window.moveTo(200,100); //(距離螢幕左邊的距離,距離螢幕頂部的距離)
window.top.moveBy(0,i); //相對移動
resizeTo(width,height);
moveTo( (screen.height-height)/2 , (screen.width-width)/2 );
window.scrollBy(1,0); // 0 , 正 , 負 值的六種組合方向
<body onLoad="setInterval('window.scrollBy(0,1)',50)">
定義body的CSS
body{overflow:scroll;overflow-x:hidden;overflow-y:hidden;}
<body dir="rtl">
body
{
scrollbar-face-color : # ffd0d0 //捲軸表單顏色
scrollbar-highlight-color : ffffff //高光顏色
}
body
{onBlur="alert('out of focus')"}
window.open("newPage.html");
window.open("newPage.html","","top=100,left=300,width=300,height=200");
window.open("newPage.html',"","HERE");
fullscreen=yes //全螢幕
menubar=yes //功能表
toolbar=yes //標準按鈕列,下一頁
location=yes //網址
status=yes //底下狀態列
scrollbar = yes //有捲軸
resize=yes //允許調整視窗
self.close()
window.close()
p = window.open('newPage.html');
p.close();
opener.close();
var p = window.open("receive.html","","width=300,height=200,top=300,left=800");
var msg = textID.value;
p.document.write("<p>" + msg + "</p>");
setTimeout(self.close(),5000);
setTimeout(myfunction,5000); //不可myfunction()
JavaScript實用範例辭典-孫俊平
現在有一場景,上面有很多遊戲物件,當滑鼠點擊畫面時,我們可以得到以下資訊:1、點擊位置的座標(screenspace、worldspace)2、是否點擊到物件3、點擊到哪個物件
場景中有很多物件,要做當滑鼠點擊物件時,知道是點到哪個物件。先將遊戲物件標籤,以供程式判斷;gameobject.tag
使用到Input.GetMouseButtonDown來觸發,接下來是將點擊到的位置由Screenspace轉成遊戲世界的World space
- var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
將由攝影機投射出光線,包含著位置與方向資訊。如果攝影機射出的光線,有碰擊到遊戲物件(collider),回返回true,然後hit會得到光線與collider在哪個位置被碰到的物件資訊。
- Physics.Raycast(ray,hit);
- point = hit.point; (哪個位置)
- object = hit.transform.gameObject;(哪個物件)
#pragma strict
var Ball : GameObject;
var object: GameObject;
var point: Vector3;
function Start () {
}
function Update () {
if(Input.GetMouseButtonDown(0))
{
//Instantiate(Ball,Input.mousePosition,transform.rotation);
//print(Input.mousePosition);
var hit: RaycastHit;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, hit))
{
point = hit.point;
object = hit.transform.gameObject;
//print(object.tag);
print(point);
Instantiate(Ball,point,transform.rotation);
}
else
{
print("SHIT");
}
}
}
Unity Document
在Unity 中使用input 物件來偵測滑鼠,鍵盤事件。
偵測情況基本上有三種:1、GetKey : 當按下時會持續作用2、GetKeyDown : 當按下那一刻才會作用3,GetKeyUp : 當按下後放開那一刻才會作用
if(Input.GetMouseButton(0))Debug.Log("Pressed left click.");if(Input.GetMouseButton(1))Debug.Log("Pressed right click.");if(Input.GetMouseButton(2))Debug.Log("Pressed middle click.");
gameObject.transform.position = Vector3(x,y,z);
gameObject.transform.Translate(x,y,z);
gameObject.transform.Rotate(0,30*Time.deltaTime,0);
gameObject.transform.rotation = Quaternion.Euler(0,30,0);
public var Camera3 : GameObject;Camera1.active = true;
Input.GetMouseButtonDown(1)
var prefabObj : GameObject;Instantiate(prefabObj,transform.position,transform.rotation);
Application.LoadLevel("Sence2")
Application.LoadLevel(0);
Refence
Application.OpenURL("www.google.com");
建立空元件,並加上audiosource component,將mp3拉進audiosource
var audio_A : AduioSource;
aduio.play();
more
Application.CaptureScreenShot("filename.png");
CG數位學習網
彥霖實驗筆記
Mustangs By Robert Glen, Las Colinas, Texas, USA 城市中表達奔騰的馬,利用水與幫浦 |
Expansion by Paige Bradley, New York, USA 如果要在雕像上加入光的元素 |
結合雕像意象與城市中的現有景 People Of The River By Chong Fah Cheong, Singapore |
結合現實景,充滿隱喻性 The Shoes On The Danube Bank by Can Togay & Gyula Pauer, Budapest, Hungary |
將雕像與場景結合 Les Voyageurs, Marseilles, France |
將一瞬間,表達出來 De Vaartkapoen, Brussels, Belgium |
將城市的表面,化為上層面 Sinking Building Outside State Library, Melbourne, Australia |
天空與雕朔的結合 Man Hanging Out, Prague, Czech Republic |
結合城市中的垃圾桶,思考一下,公共空間中,有什麼可以拿來用。 |
把一個超現實的樣子,放在現實的公共空間中 |