Depth Sorting
Use this code to sort objects in 3d space.
function sortDepthOfField(clipArray) {
clipArray.sort(clipYSort);
for (var i = 0; i<clipArray.length; i++) {
clipArray[i].swapDepths(i);
}
}
sortOnY = function(a,b){
if(a._y > b._y){
return 1;
}else if(a._y < b._y){
return -1;
}else{
return 0;
}
}
theClips = [bird1, bird2, bird3, bird4, bird5, bird6];
this.onEnterFrame = function() {
sortDepthOfField(theClips);
};
1 comment:
We are Vision Studios Design. We are a Virginia web design company based out of Harrisonburg. We specialize in web, print, development, virginia mobile apps, harrisonburg graphic design, search engine marketing, virginia search engine optimization, social media, and other traditional forms of harrisonburg marketing. Check out our latest phone app, TextGauge. Make sure to look at our portfolio at www.visionstudiosdesign.com
Post a Comment