3D Layer Distributer with Keyframing

What type of scripts do you need?

Moderator: byronnash

Post Reply
djelder
Posts: 2
Joined: December 11th, 2008, 10:37 am

Hi, I am using this code, 3D Distributer on Z- Axis:

Code: Select all

// 
// 
//3D Layer Distributor by Lloyd Alvarez (July 2006) http://aescripts.com 
// fixed random function - feb2008 
// 
// 
//Distributes layers in 3D space within set ranges.. 
// 
// 
// 
// 

var myComp = app.project.activeItem; 
var safeToRun = true; 

var myComp = app.project.activeItem; 
if (myComp == null || !(myComp instanceof CompItem)) { 
alert("A Comp must be active to run this script"); 
safeToRun = false; 
}	

if (safeToRun) {	
clearOutput(); 
app.beginUndoGroup("3D Layer Distributor"); 

// Set Range parameters here: [min,max] 

var set_X = [-2500,2500]; 
var set_Y = [-1000,1000]; 
var set_Z = [-12000,-2000];	





var selectedLayers = myComp.selectedLayers; 



for (var i = 0; i < selectedLayers.length; i++) { 
var myLayer = selectedLayers[i]; 

var x = 0; 
var y = 0; 
var z = 0; 
x = set_X[0] + (set_X[1]-set_X[0]) * Math.random() ; 
y = set_Y[0] + (set_Y[1]-set_Y[0]) * Math.random() ; 
z = set_Z[0] + (set_Z[1]-set_Z[0]) * Math.random() ; 


var myVal = myLayer.property("Position").value; 
myLayer.property("Position").setValueAtKey([myVal[0],myVal[1],z]); 




} 
writeLn("Distributed " + selectedLayers.length + " Layers"); 
app.endUndoGroup(); 
}
And I'm trying to get it to keyframe at the points I want it to change, and it's not allowing me it's something to do with Line 52:

Code: Select all

myLayer.property("Position").setValue([myVal[0],myVal[1],z]); 
Any ideas? Also if I wanted various scripts to add keyframes, what should I add, if there is a single solution?

Thanks

Dan
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

Hey Dan,

I recently updated that script to support adding a keyframe if there are already position keyframes and to be able to discreetly distribute each axis.

http://aescripts.com/3d-layer-distributor/

-Lloyd
djelder
Posts: 2
Joined: December 11th, 2008, 10:37 am

Awesome Lloyd, thanks for letting me know. I'm excited to play with that, it'll certainly give the function a lot more to play with. Cheers

Dan
Post Reply