I’m trying to make a gallery out the example found here http://www.kirupa.com/developer/actionscript/camera_panning.htm.
How would I go about applying an alpha value to each item depending on where it’s at.
Example (farthest away = alpha of 0 closest = alpha of 100)
Thanks,
Saveth
// ===========================================================
// INITIALIZE SCENE
// ===========================================================
this.createEmptyMovieClip("theScene", 1);
theScene._x = Stage.width/2;
theScene._y = Stage.height/2-10;
objectsInScene = new Array();
focalLength = 1000;
spin = 0;
// ===========================================================
// ===========================================================
// DISPLAY PANE
// ===========================================================
displayPane = function(){
var angle = this.angle + spin;
var x = Math.cos(angle)*this.radius;
var z = Math.sin(angle)*this.radius;
var y = this.y;
var scaleRatio = focalLength/(focalLength + z);
this._x = x * scaleRatio;
this._y = y * scaleRatio;
this._xscale = this._yscale = 45 * scaleRatio;
this._xscale *= Math.sin(angle);
this.swapDepths(Math.round(-z));
};
// ===========================================================
// ===========================================================
// ATTACH OBJECTS
// ===========================================================
angleStep = 2*Math.PI/6;
for (i=0; i < 6; i++){
attachedObj = theScene.attachMovie("pane", "pane"+i, i);
attachedObj.angle = angleStep * i;
attachedObj.radius = 400;
attachedObj.x = Math.cos(attachedObj.angle) * attachedObj.radius;
attachedObj.z = Math.sin(attachedObj.angle) * attachedObj.radius;
attachedObj.y = 40;
attachedObj.display = displayPane;
objectsInScene.push(attachedObj);
}
// ===========================================================
// ===========================================================
// TRACK MOUSE
// ===========================================================
panCamera = function(){
spin -= this._xmouse/1000;
for (var i=0; i < objectsInScene.length; i++){
objectsInScene*.display();
}
};
theScene.onEnterFrame = panCamera;
// ===========================================================