- 浏览: 122109 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
zhouhaiyang88:
huang-tao 写道你好,在吗?请问,我启动Tomcat时 ...
ActiveMq-JMS简单实例使用tomcat -
xurichusheng:
huang-tao 写道你好,在吗?请问,我启动Tomcat时 ...
ActiveMq-JMS简单实例使用tomcat -
wgcooo:
javax.naming.NameNotFoundExcept ...
ActiveMq-JMS简单实例使用tomcat -
huang-tao:
你好,在吗?请问,我启动Tomcat时报如下错,是什么原因?= ...
ActiveMq-JMS简单实例使用tomcat -
Eric.Yan:
好文章,明天试一试
ActiveMq-JMS简单实例使用tomcat
3D线条:把上一篇中的3D坐标旋转示例稍做修改,用线把各个小球连接起来即可。
var
balls:
Array
;
var
numBalls:
uint
=
30
;
var
fl:
Number
=
250
;
var
vpx:
Number
=stage.stageWidth/
2
;
var
vpy:
Number
=stage.stageHeight/
2
;
function
init():
void
{
balls=
new
Array
(numBalls);
for
(
var
i:
uint
=
0
; i<numBalls; i++) {
var
ball:Ball3D=
new
Ball3D(
0
,
0x000000
);
//注意:我们只需要线条,不需要小球,所以这里把小球的半径设置为0
balls[i]=ball;
ball.xpos = (Math.random()*
2
-
1
)*
100
;
ball.ypos = (Math.random()*
2
-
1
)*
100
;
ball.zpos = (Math.random()*
2
-
1
)*
100
;
addChild(ball);
}
addEventListener(Event.ENTER_FRAME,EnterFrameHandler);
}
function
EnterFrameHandler(e:Event):
void
{
var
dx:
Number
=mouseX-vpx;
var
dy:
Number
=mouseY-vpy;
var
angleY:
Number
=dx*
0.0005
;
var
angleX:
Number
=dy*
0.0005
;
var
angleZ:
Number
=Math.sqrt(dx*dx+dy*dy)*
0.0005
;
if
(dx>
0
) {
angleZ*=-
1
;
}
//以鼠标所在点的x坐标相对于消失点的位置为判断依据,左侧z轴正向旋转,右侧z轴反向旋转
for
(
var
i:
uint
; i<numBalls; i++) {
var
b:Ball3D=balls[i];
rotateX(b,angleX);
rotateY(b,angleY);
rotateZ(b,angleZ);
doPerspective(b);
}
//画线(注:画线处理,只能在所有旋转及透视完成之后再处理,否则如果先画好线,再处理旋转的话,因为小球的坐标已经变了,所以看上去线条的接头有可能不连续)
graphics.clear();
graphics.lineStyle(
0
);
graphics.moveTo(balls[
0
].x, balls[
0
].y);
for
(i =
1
; i < numBalls; i++) {
graphics.lineTo(balls[i].x, balls[i].y);
}
graphics.lineTo(balls[
0
].x, balls[
0
].y);
//sortZ(); //注意:这里不能加z轴排序,因为z轴排序会不断修正小球的数组索引,导致上面的每跟线条的连接两端不断变化,在视觉上就产生了抖动
}
//x轴的坐标旋转
function
rotateX(ball:Ball3D, angleX:
Number
):
void
{
var
cosX:
Number
=Math.cos(angleX);
var
sinX:
Number
=Math.sin(angleX);
var
y1:
Number
=ball.ypos*cosX-ball.zpos*sinX;
var
z1:
Number
=ball.zpos*cosX+ball.ypos*sinX;
ball.ypos=y1;
ball.zpos=z1;
}
//y轴的坐标旋转
function
rotateY(ball:Ball3D, angleY:
Number
):
void
{
var
cosY:
Number
=Math.cos(angleY);
var
sinY:
Number
=Math.sin(angleY);
var
x1:
Number
=ball.xpos*cosY-ball.zpos*sinY;
var
z1:
Number
=ball.zpos*cosY+ball.xpos*sinY;
ball.xpos=x1;
ball.zpos=z1;
}
//z轴的坐标旋转
function
rotateZ(ball:Ball3D, angleZ:
Number
):
void
{
var
cosZ:
Number
=Math.cos(angleZ);
var
sinZ:
Number
=Math.sin(angleZ);
var
x1:
Number
=ball.xpos*cosZ-ball.ypos*sinZ;
var
y1:
Number
=ball.ypos*cosZ+ball.xpos*sinZ;
ball.xpos=x1;
ball.ypos=y1;
}
//3D透视处理
function
doPerspective(ball:Ball3D):
void
{
if
(ball.zpos>- fl) {
var
scale:
Number
= fl / (fl + ball.zpos);
ball.scaleX=ball.scaleY=scale;
ball.x=vpx+ball.xpos*scale;
ball.y=vpy+ball.ypos*scale;
//ball.alpha = scale*0.65;
ball.visible=
true
;
}
else
{
ball.visible=
false
;
}
}
//z轴排序
function
sortZ():
void
{
balls.sortOn(
"zpos"
,
Array
.DESCENDING|
Array
.NUMERIC);
for
(
var
i:
uint
=
0
; i<numBalls; i++) {
setChildIndex(balls[i],i);
}
}
init();
如果从性能优化的角度考虑:Ball3D类用在这里比较浪费,Ball3D继承自Sprite,而我们在这里其实仅仅只要一个拥有少数几个属性(比如xpos,ypos,zpos之类)的点而已,对于Sprite默认的其它属性,包括事件支持,都是不需要的。
所以...我们又多出了一个新类Point3D
package
{
public
class
Point3D {
public
var
fl:
Number
=
250
;
private
var
vpX:
Number
=
0
;
private
var
vpY:
Number
=
0
;
private
var
cX:
Number
=
0
;
private
var
cY:
Number
=
0
;
private
var
cZ:
Number
=
0
;
public
var
x:
Number
=
0
;
public
var
y:
Number
=
0
;
public
var
z:
Number
=
0
;
public
function
Point3D(x:
Number
=
0
, y:
Number
=
0
, z:
Number
=
0
) {
this
.x=x;
this
.y=y;
this
.z=z;
}
public
function
setVanishingPoint(vpX:
Number
, vpY:
Number
):
void
{
this
.vpX=vpX;
this
.vpY=vpY;
}
public
function
setCenter(cX:
Number
,cY:
Number
,cZ:
Number
=
0
):
void
{
this
.cX=cX;
this
.cY=cY;
this
.cZ=cZ;
}
public
function
get
screenX():
Number
{
var
scale:
Number
= fl / (fl + z + cZ);
return
vpX + cX + x * scale;
}
public
function
get
screenY():
Number
{
var
scale:
Number
= fl / (fl + z + cZ);
return
vpY + cY + y * scale;
}
public
function
rotateX(angleX:
Number
):
void
{
var
cosX:
Number
=Math.cos(angleX);
var
sinX:
Number
=Math.sin(angleX);
var
y1:
Number
=y*cosX-z*sinX;
var
z1:
Number
=z*cosX+y*sinX;
y=y1;
z=z1;
}
public
function
rotateY(angleY:
Number
):
void
{
var
cosY:
Number
=Math.cos(angleY);
var
sinY:
Number
=Math.sin(angleY);
var
x1:
Number
=x*cosY-z*sinY;
var
z1:
Number
=z*cosY+x*sinY;
x=x1;
z=z1;
}
public
function
rotateZ(angleZ:
Number
):
void
{
var
cosZ:
Number
=Math.cos(angleZ);
var
sinZ:
Number
=Math.sin(angleZ);
var
x1:
Number
=x*cosZ-y*sinZ;
var
y1:
Number
=y*cosZ+x*sinZ;
x=x1;
y=y1;
}
}
}
利用这个类重写最开头的示例:
package
{
import
flash.display.Sprite;
import
flash.events.Event;
public
class
Lines3D_B
extends
Sprite {
private
var
points:
Array
;
private
var
numPoints:
uint
=
50
;
private
var
fl:
Number
=
250
;
private
var
vpX:
Number
=stage.stageWidth/
2
;
private
var
vpY:
Number
=stage.stageHeight/
2
;
public
function
Lines3D_B() {
init();
}
private
function
init():
void
{
points =
new
Array
();
for
(
var
i:
uint
=
0
; i < numPoints; i++) {
var
point:Point3D=
new
Point3D(Math.random()*
200
-
100
,Math.random()*
200
-
100
,Math.random()*
200
-
100
);
point.setVanishingPoint(vpX, vpY);
points.push(point);
}
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private
function
onEnterFrame(event:Event):
void
{
var
angleX:
Number
= (mouseY - vpY) * .
001
;
var
angleY:
Number
= (mouseX - vpX) * .
001
;
for
(
var
i:
uint
=
0
; i < numPoints; i++) {
var
point:Point3D=points[i];
point.rotateX(angleX);
point.rotateY(angleY);
}
graphics.clear();
graphics.lineStyle(
0
);
graphics.moveTo(points[
0
].screenX, points[
0
].screenY);
for
(i =
1
; i < numPoints; i++) {
graphics.lineTo(points[i].screenX, points[i].screenY);
}
}
}
}
上面的示例各线条的节点都是随机分布在三维空间的,如果把这些点按一定的顺序排列好,结果会更有趣:
上图示意了一个z轴平面的正方形,其4个顶点的(x,y,z)坐标如图所示
package
{
import
flash.display.Sprite;
import
flash.events.Event;
public
class
Square3D
extends
Sprite {
private
var
points:
Array
;
private
var
numPoints:
uint
=
4
;
private
var
fl:
Number
=
250
;
private
var
vpX:
Number
=stage.stageWidth/
2
;
private
var
vpY:
Number
=stage.stageHeight/
2
;
public
function
Square3D() {
init();
}
private
function
init():
void
{
points =
new
Array
();
points[
0
]=
new
Point3D(-
80
,-
80
,
50
);
points[
1
]=
new
Point3D(
80
,-
80
,
50
);
points[
2
]=
new
Point3D(
80
,
80
,
50
);
points[
3
]=
new
Point3D(-
80
,
80
,
50
);
//设置每个点的消失点
for
(
var
i:
uint
=
0
; i < numPoints; i++) {
points[i].setVanishingPoint(vpX, vpY);
}
addEventListener(Event.ENTER_FRAME, EnterFrameHandler);
}
private
function
EnterFrameHandler(e:Event):
void
{
var
dx:
Number
= mouseX - vpX;
var
dy:
Number
= mouseY - vpY;
var
angleX:
Number
= dy *
0.001
;
var
angleY:
Number
= dx *
0.001
;
var
angleZ:
Number
= Math.sqrt(dx*dx+dy*dy)*
0.0005
;
if
(dx>
0
){angleZ*=-
1
;}
for
(
var
i:
uint
=
0
; i < numPoints; i++) {
var
point:Point3D=points[i];
point.rotateX(angleX);
point.rotateY(angleY);
point.rotateZ(angleZ);
}
graphics.clear();
graphics.lineStyle(
0
);
graphics.moveTo(points[
0
].screenX, points[
0
].screenY);
for
(i =
1
; i < numPoints; i++) {
graphics.lineTo(points[i].screenX, points[i].screenY);
}
graphics.lineTo(points[
0
].screenX, points[
0
].screenY);
}
}
}
ok,我们成功的搞出了一个在三维空间晃荡的正方形!
理解这种思路后,理论上可以做出任意的几何形状,比如下面这张图:
var
pointNum:
int
=
10
;
var
points:
Array
=
new
Array
();
var
vpX:
Number
=stage.stageWidth/
2
;
var
vpY:
Number
=stage.stageHeight/
2
;
function
Init():
void
{
points.push(
new
Point3D(-
100
,-
140
,
0
));
points.push(
new
Point3D(
100
,-
140
,
0
));
points.push(
new
Point3D(
100
,-
90
,
0
));
points.push(
new
Point3D(-
40
,-
90
,
0
));
points.push(
new
Point3D(-
40
,-
40
,
0
));
points.push(
new
Point3D(
80
,-
40
,
0
));
points.push(
new
Point3D(
80
,
10
,
0
));
points.push(
new
Point3D(-
40
,
10
,
0
));
points.push(
new
Point3D(-
40
,
140
,
0
));
points.push(
new
Point3D(-
100
,
140
,
0
));
for
(
var
i:
uint
=
0
; i < pointNum; i++) {
points[i].setVanishingPoint(vpX, vpY);
points[i].setCenter(
0
,
0
,
100
);
}
addEventListener(Event.ENTER_FRAME, EnterFrameHandler);
}
function
EnterFrameHandler(e:Event):
void
{
var
dx:
Number
=mouseX-vpX;
var
dy:
Number
=mouseY-vpY;
var
angleX:
Number
=dy*
0.001
;
var
angleY:
Number
=dx*
0.001
;
var
angleZ:
Number
=Math.sqrt(dx*dx+dy*dy)*
0.0005
;
if
(dx>
0
) {
angleZ*=-
1
;
}
for
(
var
i:
uint
=
0
; i < pointNum; i++) {
var
point:Point3D=points[i];
point.rotateX(angleX);
point.rotateY(angleY);
point.rotateZ(angleZ);
}
Draw();
}
function
Draw():
void
{
graphics.clear();
graphics.lineStyle(
1
);
graphics.beginFill(
0xff0000
);
graphics.moveTo(points[
0
].screenX,points[
0
].screenY);
for
(
var
i:
uint
=
1
; i<pointNum; i++) {
graphics.lineTo(points[i].screenX,points[i].screenY);
}
graphics.lineTo(points[
0
].screenX,points[
0
].screenY);
graphics.endFill();
}
Init();
如果形状是没有空洞的,上面的办法无疑是最方便的办法,但是如果形状本身上有“洞”,比如下面这样:
如果仍然套用上面的方法,至少还得多写段代码处理中间这个空洞的"画线",再极端一点想象:如果形状中的空洞不止一个,有很多个的话,处理的代码就更复杂了。通常在3D编程中,业内更倾向于用“三角形”来处理这种复杂情况。如上图所示:整个A可以看作是0到10一共是11个小三角形组成的,可以先把三角形抽象成一个类
package
{
import
flash.display.Graphics;
public
class
Triangle
{
private
var
pointA:Point3D;
private
var
pointB:Point3D;
private
var
pointC:Point3D;
private
var
color:
uint
;
public
function
Triangle(a:Point3D, b:Point3D, c:Point3D, color:
uint
)
{
pointA = a;
pointB = b;
pointC = c;
this
.color = color;
}
public
function
draw(g:Graphics):
void
{
g.beginFill(color);
g.moveTo(pointA.screenX, pointA.screenY);
g.lineTo(pointB.screenX, pointB.screenY);
g.lineTo(pointC.screenX, pointC.screenY);
g.lineTo(pointA.screenX, pointA.screenY);
g.endFill();
}
}
}
接下来的事情就比较简单了,定义一个三角形数组,然后根据顶点坐标初始化这个数组,然后各顶点的坐标该咋旋转就咋旋转,完事之后重新填充绘制三角形数组。
var
pointNum:
int
=
11
;
var
points:
Array
=
new
Array
(pointNum);
var
triangles:
Array
;
//三角形数组
var
vpX:
Number
= stage.stageWidth /
2
;
var
vpY:
Number
= stage.stageHeight /
2
;
function
Init():
void
{
points[
0
] =
new
Point3D(-
50
,-
250
,
100
);
points[
1
] =
new
Point3D(
50
,-
250
,
100
);
points[
2
] =
new
Point3D(
200
,
250
,
100
);
points[
3
] =
new
Point3D(
100
,
250
,
100
);
points[
4
] =
new
Point3D(
50
,
100
,
100
);
points[
5
] =
new
Point3D(-
50
,
100
,
100
);
points[
6
] =
new
Point3D(-
100
,
250
,
100
);
points[
7
] =
new
Point3D(-
200
,
250
,
100
);
points[
8
] =
new
Point3D(
0
,-
150
,
100
);
points[
9
] =
new
Point3D(
50
,
0
,
100
);
points[
10
] =
new
Point3D(-
50
,
0
,
100
);
for
(
var
i:
uint
=
0
; i < pointNum; i++) {
points[i].setVanishingPoint(vpX, vpY);
points[i].setCenter(
0
,
0
,
450
);
}
//根据顶点赋值三角形数组
triangles =
new
Array
();
triangles[
0
] =
new
Triangle(points[
0
],points[
1
],points[
8
],
0xff0000
);
triangles[
1
] =
new
Triangle(points[
1
],points[
9
],points[
8
],
0xff0000
);
triangles[
2
] =
new
Triangle(points[
1
],points[
2
],points[
9
],
0xff0000
);
triangles[
3
] =
new
Triangle(points[
2
],points[
4
],points[
9
],
0xff0000
);
triangles[
4
] =
new
Triangle(points[
2
],points[
3
],points[
4
],
0xff0000
);
triangles[
5
] =
new
Triangle(points[
4
],points[
5
],points[
9
],
0xff0000
);
triangles[
6
] =
new
Triangle(points[
9
],points[
5
],points[
10
],
0xff0000
);
triangles[
7
] =
new
Triangle(points[
5
],points[
6
],points[
7
],
0xff0000
);
triangles[
8
] =
new
Triangle(points[
5
],points[
7
],points[
10
],
0xff0000
);
triangles[
9
] =
new
Triangle(points[
0
],points[
10
],points[
7
],
0xff0000
);
triangles[
10
] =
new
Triangle(points[
0
],points[
8
],points[
10
],
0xff0000
);
addEventListener(Event.ENTER_FRAME, EnterFrameHandler);
}
function
EnterFrameHandler(e:Event):
void
{
var
dx:
Number
= mouseX - vpX;
var
dy:
Number
= mouseY - vpY;
var
angleX:
Number
= dy *
0.001
;
var
angleY:
Number
= dx *
0.001
;
var
angleZ:
Number
= Math.sqrt(dx * dx + dy * dy) *
0.0005
;
if
(dx >
0
) {
angleZ *= -
1
;
}
for
(
var
i:
uint
=
0
; i < pointNum; i++) {
var
point:Point3D = points[i];
point.rotateX(angleX);
point.rotateY(angleY);
point.rotateZ(angleZ);
}
graphics.clear();
//画三角形
for
(i=
0
; i<triangles.length; i++) {
triangles[i].draw(graphics);
}
}
Init();
旋转的立方体
示意图如下:
var
pointNum:
int
=
8
;
var
points:
Array
=
new
Array
(pointNum);
var
triangles:
Array
;
//三角形数组
var
vpX:
Number
= stage.stageWidth /
2
;
var
vpY:
Number
= stage.stageHeight /
2
;
function
Init():
void
{
//前面四个角
points[
0
] =
new
Point3D(-
100
,-
100
,-
100
);
points[
1
] =
new
Point3D(
100
,-
100
,-
100
);
points[
2
] =
new
Point3D(
100
,
100
,-
100
);
points[
3
] =
new
Point3D(-
100
,
100
,-
100
);
//后面四个角
points[
4
] =
new
Point3D(-
100
,-
100
,
100
);
points[
5
] =
new
Point3D(
100
,-
100
,
100
);
points[
6
] =
new
Point3D(
100
,
100
,
100
);
points[
7
] =
new
Point3D(-
100
,
100
,
100
);
for
(
var
i:
uint
=
0
; i < pointNum; i++) {
points[i].setVanishingPoint(vpX, vpY);
points[i].setCenter(
0
,
0
,
100
);
}
//根据顶点赋值三角形数组
triangles =
new
Array
();
var
_t:
Number
= Math.random() *
0xffffff
;
triangles[
0
] =
new
Triangle(points[
0
],points[
1
],points[
2
],_t);
triangles[
1
] =
new
Triangle(points[
0
],points[
2
],points[
3
],_t);
_t = Math.random() *
0xffffff
;
triangles[
2
] =
new
Triangle(points[
0
],points[
5
],points[
1
],_t);
triangles[
3
] =
new
Triangle(points[
0
],points[
4
],points[
5
],_t);
_t = Math.random() *
0xffffff
;
triangles[
4
] =
new
Triangle(points[
4
],points[
6
],points[
5
],_t);
triangles[
5
] =
new
Triangle(points[
4
],points[
7
],points[
6
],_t);
_t = Math.random() *
0xffffff
;
triangles[
6
] =
new
Triangle(points[
3
],points[
2
],points[
6
],_t);
triangles[
7
] =
new
Triangle(points[
3
],points[
6
],points[
7
],_t);
_t = Math.random() *
0xffffff
;
triangles[
8
] =
new
Triangle(points[
1
],points[
5
],points[
6
],_t);
triangles[
9
] =
new
Triangle(points[
1
],points[
6
],points[
2
],_t);
_t = Math.random() *
0xffffff
;
triangles[
10
] =
new
Triangle(points[
4
],points[
0
],points[
3
],_t);
triangles[
11
] =
new
Triangle(points[
4
],points[
3
],points[
7
],_t);
addEventListener(Event.ENTER_FRAME, EnterFrameHandler);
}
function
EnterFrameHandler(e:Event):
void
{
var
dx:
Number
= mouseX - vpX;
var
dy:
Number
= mouseY - vpY;
var
angleX:
Number
= dy *
0.001
;
var
angleY:
Number
= dx *
0.001
;
var
angleZ:
Number
= Math.sqrt(dx * dx + dy * dy) *
0.0005
;
if
(dx >
0
) {
angleZ *= -
1
;
}
for
(
var
i:
uint
=
0
; i < pointNum; i++) {
var
point:Point3D = points[i];
point.rotateX(angleX);
point.rotateY(angleY);
point.rotateZ(angleZ);
}
graphics.clear();
//画三角形
for
(i=
0
; i<triangles.length; i++) {
triangles[i].draw(graphics);
}
}
Init();
当然,在学习"背面剔除"前,为了防止六个面同时填充颜色相互遮挡,我们可以先把Triangle.cs中的draw方法临时修改一下
public
function
draw(g:Graphics):
void
{
g.beginFill(color,
0.4
);
//改成40%透明度填充
g.moveTo(pointA.screenX, pointA.screenY);
g.lineTo(pointB.screenX, pointB.screenY);
g.lineTo(pointC.screenX, pointC.screenY);
g.lineTo(pointA.screenX, pointA.screenY);
g.endFill();
}
利用这个原理,可以创建更多复杂的3D模型
3D金字塔型:
var
pointNum:
int
=
5
;
var
points:
Array
=
new
Array
(pointNum);
var
triangles:
Array
;
//三角形数组
var
vpX:
Number
= stage.stageWidth /
2
;
var
vpY:
Number
= stage.stageHeight /
2
;
function
Init():
void
{
points[
0
] =
new
Point3D(
0
,-
200
,
0
);
points[
1
] =
new
Point3D(
200
,
200
,-
200
);
points[
2
] =
new
Point3D(-
200
,
200
,-
200
);
points[
3
] =
new
Point3D(-
200
,
200
,
200
);
points[
4
] =
new
Point3D(
200
,
200
,
200
);
for
(
var
i:
uint
=
0
; i < pointNum; i++) {
points[i].setVanishingPoint(vpX, vpY);
points[i].setCenter(
0
,
0
,
450
);
}
//根据顶点赋值三角形数组
triangles =
new
Array
();
var
_t:
Number
= Math.random() *
0xffffff
;
triangles[
0
] =
new
Triangle(points[
0
],points[
1
],points[
2
],_t);
_t = Math.random() *
0xffffff
;
triangles[
1
] =
new
Triangle(points[
0
],points[
2
],points[
3
],_t);
_t = Math.random() *
0xffffff
;
triangles[
2
] =
new
Triangle(points[
0
],points[
3
],points[
4
],_t);
_t = Math.random() *
0xffffff
;
triangles[
3
] =
new
Triangle(points[
0
],points[
4
],points[
1
],_t);
_t = Math.random() *
0xffffff
;
triangles[
4
] =
new
Triangle(points[
1
],points[
3
],points[
2
],_t);
//_t = Math.random() * 0xffffff;
triangles[
5
] =
new
Triangle(points[
1
],points[
4
],points[
3
],_t);
addEventListener(Event.ENTER_FRAME, EnterFrameHandler);
}
function
EnterFrameHandler(e:Event):
void
{
var
dx:
Number
= mouseX - vpX;
var
dy:
Number
= mouseY - vpY;
var
angleX:
Number
= dy *
0.001
;
var
angleY:
Number
= dx *
0.001
;
var
angleZ:
Number
= Math.sqrt(dx * dx + dy * dy) *
0.0005
;
if
(dx >
0
) {
angleZ *= -
1
;
}
for
(
var
i:
uint
=
0
; i < pointNum; i++) {
var
point:Point3D = points[i];
point.rotateX(angleX);
point.rotateY(angleY);
point.rotateZ(angleZ);
}
graphics.clear();
//画三角形;
for
(i=
0
; i<triangles.length; i++) {
triangles[i].draw(graphics);
}
}
Init();
把前面示例中的A字型示例扩展一下,变成二层(即:再复制一层A,然后在z轴上推移若干距离,然后用线条连起来)
var
pointNum:
int
=
22
;
发表评论
-
Flash/Flex学习笔记(50):矩阵变换
2011-04-24 13:52 1163先回顾一下Silvelright中的矩阵变换[转]WPF中的M ... -
Flash/Flex学习笔记(49):背面剔除与 3D 灯光
2011-04-24 13:50 974今天继续:上一回Flash/Flex学习笔记(50):3D线条 ... -
Flash/Flex学习笔记(48):迷你滚动条ScrollBar
2011-04-24 13:46 1062先看最终效果: 整个swf最终不到4k, ... -
Flash/Flex学习笔记(47):利用FMS快速创建一个文本聊天室
2011-04-24 13:45 995先来看客户端fla的构成: 第一帧:登录界面 第一帧的 ... -
Flash/Flex学习笔记(46):使用TweenLite
2011-04-24 13:43 1676TweenLite是第三方出品的专用于各种缓动动画的类库,其性 ... -
Flash/Flex学习笔记(45):3维旋转与透视变换(PerspectiveProjection)
2011-04-24 13:41 1209Flash/Flex学习笔记:3D基础 里已经介绍了3D透 ... -
Flash/Flex学习笔记(43):3D基础
2011-04-24 13:34 1143之前我们所做的动画都 ... -
Flash/Flex学习笔记(42):反向运动学(下)
2011-04-24 13:30 916先要复习一下三角函数与余弦定理: 对于直角三角形,三边长 ... -
Flash/Flex学习笔记(41):反向运动学(上)
2011-04-24 13:29 939先回顾上篇所说的"正向运动学":以人行 ... -
Flash/Flex学习笔记(40):正向运动学
2011-04-24 13:27 882所谓"正向运动学"通俗点讲就是把几个连接部 ... -
Flash/Flex学习笔记(39):万有引力与粒子系统
2011-04-24 13:26 723万有引用公式: 其中G为万有引力常数 var numP ... -
Flash/Flex学习笔记(38):动量守恒与能量守恒
2011-04-24 13:24 942动能公式: 动量公式: 动量守恒: 能量守恒: ... -
Flash/Flex学习笔记(37):坐标旋转
2011-04-24 13:23 1020坐标旋转是个啥概念呢? 如上图,(蓝色)小球 绕某一 ... -
Flash/Flex学习笔记(36):碰撞检测
2011-04-24 13:22 606碰撞检测基本上可能分为二类:对象与对象的碰撞检测、对象与点 ... -
Flash/Flex学习笔记(35):弹性运动续--弹簧
2011-04-24 13:21 766上一篇里演示的弹性运动加上摩擦力因素后,物体最终基本上都会比较 ... -
Flash/Flex学习笔记(34):弹性运动
2011-04-24 13:20 771动画中的弹性运动 从视觉效果上接近 物理经典力学中的单摆运 ... -
Flash/Flex学习笔记(33):缓动动画
2011-04-24 13:18 998缓动 与 匀变速 看上去很类似,但其实有区别: 匀变速的 ... -
Flash/Flex学习笔记(32):不用系统组件(纯AS3)的视频播放器--只有8.82K
2011-04-24 13:17 1270以前为了赶项目,利用系统组件制作过一款视频播放器(见Fla ... -
Flash/Flex学习笔记(31):自己动手实现一个滑块控件(JimmySilder)
2011-04-24 13:15 966先看最终的演示: 滑块条的应用实在太广泛了:mp3播放器中声 ... -
Flash/Flex学习笔记(30):如何正确监听Stage对象的事件
2011-04-24 13:13 1295如果想在一个自定义类中注册对stage对象的监听事件,然后在另 ...
相关推荐
flex/Flash开发系列书籍:基于FLASH的WEB3D应用研究
附件是关于 Flash/Flex 几个重要框架 Cairngorm、Mate、PureMVC以及Swiz 的典型例子,由 Tony Hillerson 提供 Homepage: http://insideria.com
在IT行业中,Flash/Flex是一种基于ActionScript编程语言和Adobe Flex框架的开发工具,用于创建交互式的、富媒体的Web应用程序。"Flash/Flex画曲线,绘图板"这个主题涉及的是如何使用这些技术来创建一个允许用户自由...
语言:C ++许可证:BSD-3代码质量:A + https://lgtm.com/projects/g/Genivia/RE-flex/context:cpp文档:https://www.genivia.com/doc/reflex/html /index.html存储库:https://github.com/Genivia/RE-flex更改日志...
在IT行业中,Flash和Flex是曾经非常流行的富互联网应用程序(RIA)开发框架,它们主要用于创建交互式的网页内容和应用程序。本文将重点讲解如何在Flash或Flex项目中利用CSS(层叠样式表)来定义文本样式,提升用户...
在IT行业中,Flash/Flex是一种广泛使用的开发工具,主要用于创建交互式、富媒体的Web应用程序。Flex是基于ActionScript和MXML的开放源代码框架,它允许开发者构建可自定义的用户界面,而Flash则是其背后的动画和...
这篇教程主要介绍如何使用Flare3D在Flash/Flex环境中创建一个3D推箱子游戏的原型,重点关注3D纹理的应用。Flare3D是一个强大的工具,它为Flash开发者提供了将2D内容转换为3D场景的能力,使得在Flash平台上开发复杂的...
**FDT - 一款强大的Flash/Flex开发工具集** FDT(Flash Development Tool)是一款专为Adobe Flash和Flex开发者设计的集成开发环境(IDE),它基于Eclipse平台,提供了高效、专业的开发工具和服务。FDT的出现极大地...
FLEX 安装方法 集成到 eclipse 中 ...* 汉化 FLEX 尤其是 FLEX/AIR 方面的中文资料 * 原创的关于 FLEX 的博客:http://liguoliang.com/ * Adobe 公司 FLEX 主页:http://www.adobe.com/cn/products/flex/
Flex Builder(现已被Adobe Flash Builder取代)是一个集成开发环境,提供了代码提示、调试和项目管理等功能,使得开发更加高效。 3. **Flex组件库**:Flex提供了丰富的预定义组件,如Button、Label、Canvas等,可...
标题“Flex:登录”指的是使用Adobe Flex技术实现用户登录功能的一种方法。Flex是Adobe公司推出的一款基于ActionScript的开源框架,主要用于...压缩包中的"Flex Login"可能包含示例代码或项目结构,供读者学习和参考。
RTMP(Real-Time Messaging Protocol)...通过学习和理解源代码,你可以深入了解RTMP协议的实现细节,以及FLEX如何与服务器和客户端进行交互。这对于想要从事音视频直播开发的人员来说,是一个宝贵的实践和学习资源。
《FLEX学习笔记》 FLEX,全称为Flex Builder,是由Adobe公司开发的一款基于MXML和ActionScript的开源框架,用于构建富互联网应用程序(RIA)。它允许开发者创建具有交互性、响应性和丰富用户体验的Web应用。FLEX的...
在《潮汕IT男》网站的文章《解决flash/flex/as3 访问中文域名时的流错误》中,作者陈林生提供了详细的步骤和代码示例,帮助开发者理解和解决这个问题。文章地址是:[http://chenlinsheng.com/?p=990]...
1. **Flex概述**:介绍Flex技术的基本概念,包括它的历史、目标和应用领域,以及它与Flash Player和Adobe AIR的关系。 2. **Flex开发环境**:可能会讲解如何安装和配置Flex Builder或IntelliJ IDEA等开发工具,以及...
Flex开源项目介绍 Flex是一种用于构建富互联网应用程序(RIA)的开源框架,它基于ActionScript 3(AS3)编程语言和MXML标记语言。这些开源项目为开发者提供了丰富的组件库、工具和框架,帮助他们扩展Flex的功能,...
总共有4个例子: 1.http://127.0.0.1:8080/flexDemo/HelloWorld/HelloWorld.html ...如果你的数据库配置和我的不一样,请修改flexDemo\WEB-INF\classes\下的DBSetting.properties文件,数据库建表的sql语句是user.sql
Flex与Java的交互是跨平台应用开发中的常见技术组合,允许前端用户界面(UI)与后端业务逻辑进行高效沟通。在本文中,我们将深入探讨如何使用Flex 4与Java进行通信,并通过三种不同的方法实现这一目标:RemoteObject...
Flex ActionScript 学习笔记是关于使用Adobe Flex技术并结合ActionScript 3.0进行开发的知识总结。ActionScript 3.0是随着Flash CS3一起推出的一种强大的编程语言,相较于之前的ActionScript版本,它有着显著的提升...
根据提供的信息,我们可以总结出以下关于Flex学习笔记中的关键技术知识点: ### 1. Flex 基础设置 在Flex开发中,通常会涉及到基础样式的设置。例如,在给定的部分内容中提到了字体大小、颜色及背景色的设置。虽然...