Skip navigation
Lars Renklint
Currently Being Moderated

Create sphere on keyframes with expression

Jan 19, 2012 7:12 AM



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.



  • Currently Being Moderated
    Jan 20, 2012 8:58 AM   in reply to Lars Renklint

    An expression can't create layers. You'd need a script for that. Also, AE doesn't have spheres. I'm not sure what you mean by that.



    Mark as:
  • Currently Being Moderated
    Jan 22, 2012 2:47 PM   in reply to Lars Renklint

    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)







    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.



    Mark as:
  • Currently Being Moderated
    Jan 23, 2012 4:00 PM   in reply to Lars Renklint

    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;


    y=linear(note, 60, 74, 0, -100);

    centre=[50, 180, 0];





    Mark as:
  • Currently Being Moderated
    Jan 28, 2012 1:11 AM   in reply to Lars Renklint

    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

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points