?? particle3d_class.as
字號:
/*
Particle3d Class
Oct. 29, 2002
(c) 2002 Robert Penner
This custom object represents and renders a visual particle
existing in a simulated three-dimensional space.
The appearance of the particle is represented by an
attachable movie clip, and its position by a Vector3d instance.
Dependencies:
- Vector3d class
- trig_functions_degrees.as
Discussed in Chapter 5 of
Robert Penner's Programming Macromedia Flash MX
http://www.robertpenner.com/profmx
http://www.amazon.com/exec/obidos/ASIN/0072223561/robertpennerc-20
*/
if (typeof Math.cosD != "function") trace ("error: Math.cosD function mission");
// add check for Vector3d class
_global.Particle3d = function (x, y, z, timeline, mcID, depth) {
this.position = new Vector3d (x, y, z);
this.timeline = timeline;
this.mc = this.attachGraphic (mcID, depth);
this.scale = 100;
this.render();
}
Particle3d.prototype.attachGraphic = function (mcID, depth) {
return this.timeline.attachMovie (mcID,
mcID + "_" + depth,
depth);
};
Particle3d.prototype.render = function () {
var pers = this.position.getPerspective();
this.screenPos = this.position.persProjectNew (pers);
with (this.mc) {
_x = this.screenPos.x;
_y = -this.screenPos.y;
_xscale = _yscale = this.scale * pers;
swapDepths (100000 - this.position.z * 100);
}
};
trace (">> Particle3d class loaded");
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -