Google Èýά JavaScript API ·¢²¼
O3D ÊÇÒ»¸ö¿ªÔ´µÄWeb API£¬Æä¿ÉÒÔ´´½¨Ï൱ţXµÄ»ùÓÚä¯ÀÀÆ÷µÄ¿É½»»¥Ê½µÄ3DÓ¦Óá£Õâ¸öAPIÔÚºÜÓпÉÄÜ»áÐγÉÒÔºóµÄWebÉϵÄ3DͼÐεıê×¼¡£ÏÂÃæÊÇÕâ¸öAPIµÄÖ÷Õ¾µã£º http://code.google.com/apis/o3d/ ¡£O3DÄ¿Ç°Ö§³ÖWindows, MacºÍLinuxÈýÖÖƽ̨¡£
ÏÂÃæÊÇһЩ¼òµ¥µØʹÓÃO3DµÄAPIµÄÈçºÎ´´½¨Ò»¸öÁ¢·½Ì壬¸üÏêϸµÄÄÚÈÝÇë·ÃÎÊO3DµÄÍøÕ¾¡£
1£©Ê×Ñ¡ÎÒÃÇÏÈ´´½¨Ò»¸ö±È½ÏÔʼµÄÁ¢·½Ì塣ʹÓÃcreateCube()·½·¨¡£
01
function createCube(material) {
02
var cubeShape = g_pack.createObject('Shape');
03
var cubePrimitive = g_pack.createObject('Primitive');
04
var streamBank = g_pack.createObject('StreamBank');
05
06
cubePrimitive.material = material;
07
cubePrimitive.owner(cubeShape);
08
cubePrimitive.streamBank = streamBank;
09
.
10
.
11
.
2£©È»ºó£¬ÎÒÃÇÐèÒªÖ¸¶¨Ò»Ð©¶¥µãÐÅÏ¢¡£
ÆäÖУ¬ÎÒÃÇÀûÓÃÈý½ÇÐÎÀ´¹¹Ôì3DͼÐΡ£Ò»¸öÁ¢·½ÌåÓÐ12¸öÈý½ÇÃ棬Á½¸ö¹¹³ÉÒ»¸öÃ棬ȻºóÓÐ8¸ö¶¥µã¡£
1
cubePrimitive.primitiveType = g_o3d.Primitive.TRIANGLELIST;
2
cubePrimitive.numberPrimitives = 12; // 12 triangles
3
cubePrimitive.numberVertices = 8; // 8 vertices in total
4
cubePrimitive.createDrawElement(g_pack, null); // Create the draw element for this primitive.
3£©Ö¸¶¨Ò»ÏÂ8¸ö¶¥µãµÄ×ø±ê¡£
01
var positionArray = [
02
-0.5, -0.5, 0.5, // vertex 0
03
0.5, -0.5, 0.5, // vertex 1
04
-0.5, 0.5, 0.5, // vertex 2
05
0.5, 0.5, 0.5, // vertex 3
06
-0.5, 0.5, -0.5, // vertex 4
07
0.5, 0.5, -0.5, // vertex 5
08
-0.5, -0.5, -0.5, // vertex 6
09
0.5, -0.5, -0.5 &nb
Ïà¹ØÎĵµ£º
1
¡¢Àí½âdocument.all
[]
¡¡¡¡´ÓIE4¿ªÊ¼IEµÄobject
model²ÅÔö¼ÓÁËdocument.all
[],À´¿´¿´document.all
[]µÄDescription:
Array
of all HTML tags in the document.Collection of all elements contained by the
object.
¡¡¡¡Ò²¾ÍÊÇ˵document.all
[]ÊÇÎĵµÖÐËùÓбêÇ©×é³ÉµÄÒ»¸öÊý×é±äÁ¿£¬°üÀ¨ÁËÎĵµ¶ÔÏóÖÐËùÓ ......
Javascriptº¯ÊýÀàÐÍÅжÏÍêÃÀ½â¾ö·½°¸
ÔÚÅжϺ¯ÊýÀàÐÍʱ£¬ÎÒÃÇͨ³£Ê¹ÓÃtypeof·½·¨£¬Ò»°ãÇé¿öÏ£¬Ëü»áµÃµ½ÎÒÃÇËùÔ¤ÏëµÄЧ¹û¡£µ«ÊÇ£¬ÓÐһЩϸ½Ú²¢²»ÎªÎÒÃÇËùÊìÖª¡£John Resig ÔÚ·ÖÎöÁËÕâЩϸ½ÚÖ®ºó£¬ÎªÎÒÃÇÌṩÁËÒ»¸öÍêÃÀµÄ½â¾ö·½°¸£¬±¾ÎĽ«×÷Ïêϸ½éÉÜ£º
Ò»¡¢´«Í³·½·¨²»ÎªÈËËùÖªµÄϸ½Ú
ºÁÎÞÒÉÎÊ£¬ÔÚÅжϺ¯ÊýÀàÐÍʱ£¬ÎÒÃÇÊ ......
javascriptÉè¼ÆģʽµÚÒ»ÕÅÓÐÒ»¸öÓÐȤµÄʵÏּ̳еķ½·¨£¬µ±È»javascript±¾ÖÊÉÏÊÇʵÏּ̳У¬»¹²»ÊǵäÐÍÒâÒåÉϵÄ"is-a"µÄÂß¼¼Ì³Ð»òÕß˵ÊÇÓïÒå¼Ì³Ð¡£»ù±¾µÄ·½·¨¾ÍÊÇͨ¹ýfunctionµÄprototypeÊôÐÔ¡£
Ò»£¬ºÜ¼òµ¥µÄ·½·¨
<script type="text/javascript">
<!--
var Anim = function(){ ......
ÕâÁ½Ì쿪ʼд¹Å´úµØͼµÄGISÍøÕ¾£¬Ëµ°×Á˾ÍÊÇÓùŴúµØͼµÄÄÚÈÝЧ·ÂɽկһϹȸèµØͼ¡£
JSÕⶫÎ÷ºÜ¾ÃûдÁË£¬ÓÐЩ¸ÅÄîÒ²ºÜÄ£ºý£¬µ¼ÖÂÍê³É·Ö¿éÍ϶¯¼ÓÔصŦÄܾͻ¨Á˺öàʱ¼ä¡£
Ö÷ÒªÎÊÌâÊdzöÔÚÍ϶¯Ê±¶ÔÔªËØÄÚÈݵĶ¯Ì¬ÐÞ¸ÄÉÏ£¬×ܽáÏ¡£
ͨ¹ýJS½Å±¾¶¯Ì¬ÐÞ¸ÄDOMÔªËØÄÚÈÝͨ³£ÓÐÁ½ÖÖ·½·¨£º
1. ͨ¹ýDOM±ê×¼½Ó¿Ú´´½¨ÔªËØ
var new ......
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml ......