Hi,
I've just begun to learn after effects and could use a little help.
I have a small solid wich is moving around on the comp. This is done using expressions.
What I would like to do is first to replace it with a 3d sphere.
And secondly, instead of moving it, create a new sphere on each keyframe.
First I imagined using trapcode particular, setting the particles count to 1. But that is per second, not per keyframe.
Any ideas are appreciated.
/Lars
My understanding right now is that there probably isn't a "create" method for creating shapes or objects in expressions. Please correct me if I'm wrong.
Instead I should create my shape and then use expressions for duplicating that layer while repositioning it. Does this sound like the correct method?
It would make sense that a keyframe couldn't hold an object. On the other hand it seems you could easily end up with a trillion layers in a comp..
Hi Dan,
afraid that only shows my unfamilarity with AE. More used to 3D than 2,5D. So now I've found out that you can use the effect CC sphere and orient it towards the camera to make it look like 3D.
Let me see if I understand you correctly.
I have hundreds of keyframes with a single value in them. Then I use them to move a circle around the screen. But what if I would like to leave a copy of that circle everyplace it has been. Are my only options to either manually create lots of layers or do that with a script. No easier way?
Hmmm... assuming you're talking about position keyframes and you're working with layer 1, you could add this position expression:
if (numKeys >= index)
if (time > key(index).time)
key(index).value
else
value;
else
value
then duplicate the layer a bunch of times (one for each keyframe) and each layer should stop at the keyframe corresponding to its own layer index.
Dan
Oh, thank you. The keyframes only hold a single value so I already have an expression for the position. So the keyframes are in a separate layer.
x=time*20;
note=thisComp.layer("midi").effect("ch_0_pitch")("Slider"); //this is the keyframes
y=linear(note, 60, 74, 0, -100);
centre=[50, 180, 0];
add(centre,[x,y]);
I guess you'll need to combine the two expressions. I don't have time to test it, but this should be close:
note=thisComp.layer("midi").effect("ch_0_pitch")("Slider"); //this is the keyframes
t = time;
if ((note.numKeys >= index) && (time > note.key(index).time))
t = note.key(index).value;
x=t*20;
y=linear(note, 60, 74, 0, -100);
centre=[50, 180, 0];
add(centre,[x,y]);
Dan
Spot on. No need to change even a comma.
This is how it looks: (click on the images to see the animation)
But I guess to make those new layers do something, stay around for a while, scale etc for longer than until the next keyframe I need to give them their own keyframes. Something like this:
But I cant do that manually, I would like to use it for visualizing a song and it would take thousands of keyframes. Maybe someday I can learn to write scripts...
In a project trying to visualize Pachelbels Canon in D I'm also using David van Brinks midi-script and found the same need to transform expressions to keyframes.
Here's the beginning of the song: http://www.screencast.com/t/eAWWQtGQp
It's very simple to make the green sphere jump, just setting the keyframes in the midi-layer to hold. And the other frames to bezier (or linear, in this case it wont make a difference). But towards the end when I want the blue sphere to start bouncing I found it needed its own keyframes. So I used "Convert expression to keyframes". The problem is that it creates keyframes on every frame and I must have keyframes only where the midi-keyframes are (which often don't even line up with the start of a frame).
But some day in a far distance maybe I can write a script that creates only those keyframes that I need.
It's very simple to make the green sphere jump, just setting the keyframes in the midi-layer to hold. And the other frames to bezier (or linear, in this case it wont make a difference). But towards the end when I want the blue sphere to start bouncing I found it needed its own keyframes. So I used "Convert expression to keyframes". The problem is that it creates keyframes on every frame and I must have keyframes only where the midi-keyframes are (which often don't even line up with the start of a frame).
But some day in a far distance maybe I can write a script that creates only those keyframes that I need.
If you find a way to accomplish this Lars I am also seeking such a thing. The only work around I've found is to go piece by piece through a keyframed midi reference, adding keyframes with the values specified by the expression while it's active in the layer I need the values to change in and then turning the expression off once I'm finished.
On an off note it's nice to see more midi based animations ![]()
Hi Cheerbot,
here's how far I've come.
https://www.dropbox.com/s/8qjqft9f226uuyv/om_midi_x.jsx
Started by making sure the script only creates a keyframe for the note-on event the way Dan suggested in this thread: http://forums.adobe.com/thread/949850?tstart=0
Right now I don't need the duration and velocity, so I've commented them out. You'd have to delete my comments if you need them.
This script creates an extra slider, so for channel 0 it will create ch_0_pitch and ch_0_x
The keyframes in the extra slider simply holds the time value at that keyframe.
To use it you can separate the x and y dimensions in the position parameter you would like to change. Then paste the keyframes from ch_0_pitch to the Y position and the keyframes from ch_0_x to the X position.
If you want to make modifications you should know that the first line that has been changed by me is line 1102.
You could for example change line 1149 to var xVal = t*100; which gives you a x-value of 100 instead of 1 at time 1sec.
In AE I've used this expression - linear(value, 60, 80, 700, 100) - to change the y-values. Tried that in the script, but I guess "linear" is AE lingo and not javascript, have to look that up.
One thing I would like is to write both the x and y value to the same keyframe, instead of to two separate sliders. So if you have any suggestions please share them.
North America
Europe, Middle East and Africa
Asia Pacific