Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Bryan Woods on April 14, 2013 at 10:59 pm

    Working on a kind of Auto Ken burns effect expression and could use some guidance.

    I have a script that applies a slider control to the selected layer(s), then adds an expression to the scale to use this slider to control the speed of scale. Scaling is automatic based on the in/out points of the layer. There are some inneficiencies though, and I’d love some critique on it.

    Here’s the expression:
    zoom = effect("Zoom Speed")("Slider");
    value + linear(time, inPoint, outPoint, 0, [zoom, zoom])

    Haha, I smile every time I see that array.

    ANYWAY, this works and is fairly flexible. But its very basic. I end up repositioning the anchor point of the layer to change where it zooms into, which can be hit or miss and require a few attempts to figure out where I need to reposition the anchor so it zooms into the correct area. Ideally I’d like to initially have a random position chosen for every layer this expression is applied to (so probably driven by index number), but also be able to move the “target” where we zoom into if the random position doesn’t work. I thought possibly the point controller would be my answer, but it does some weird things when using it to move the anchor point, one of which moves the entire image inversely of the anchor point, which doesn’t help me.

    Any thoughts on the additions to this script that I want to implement? Thanks!

    Hope Holmesby replied 5 years, 8 months ago 4 Members · 3 Replies
  • 3 Replies
  • Ht Davis

    April 5, 2016 at 8:56 pm

    The position marker prevents Drifting the center point or anchor inadvertently. However, if it is readable from the comp in a script, you could set a start and end slider for it. The values could have an adjustable range that centers at normal and can drift either direction on either axis by a value no bigger than the comp’s farthest edge dimensions. They would allow you to zoom a photo to any anchor point on or off screen. Give it beginning and end keys, and viola. I’m no scripter. But your script has possibilities.

  • Kalleheikki Kannisto

    April 6, 2016 at 8:42 am

    That was more complicated than I thought, but here it is.

    For random zoom origin, you can use this expression on the position value. Note that I moved the Zoom Speed slider to a separate layer named “Controls”. If you want individual zoom speeds, you can use your original expression for the zoom.

    Disable the expression for any layers where you want to control the anchor point manually.

    zoom = thisComp.layer("Controls").effect("Zoom Speed")("Slider");
    seedRandom(index, true);
    x_origin = random(thisComp.width);
    y_origin = random(thisComp.height);
    origin = [x_origin, y_origin];
    shift = [thisComp.width/2, thisComp.height/2]-origin;
    x_shift = (shift[0]*(100+zoom)/100-shift[0]);
    y_shift = (shift[1]*(100+zoom)/100-shift[1]);
    mult = linear(time, inPoint, outPoint, 0, 1);
    [thisComp.width/2, thisComp.height/2]+mult*[x_shift, y_shift]

    with the external slider, the scale expression becomes

    zoom = thisComp.layer("Controls").effect("Zoom Speed")("Slider");
    value + linear(time, inPoint, outPoint, 0, [zoom, zoom])

  • Hope Holmesby

    August 24, 2020 at 11:09 pm

    hi Byran

    I tried this code of yours…added on each layer:

    – added the effect: Slider, renamed it ‘Zoom Speed’ as mentioned in the expression. must add this first before pasting in the expression…
    and adjusted the speed in the slider on various layers, mainly having the speed at 11. but some 33 and some 5.

    – added your expression to the scale value,
    zoom = effect(“Zoom Speed”)(“Slider”);
    value + linear(time, inPoint, outPoint, 0, [zoom, zoom])

    It depended on how much the layer was originally scaled down in the first place as to the ‘speed ‘ adjustment in the Slider Effect.

    Worked quite nicely , thank you. really great.

    What do you think?
    Warmly,
    Hope

    _____________________________________________

    Life is here to enjoy. The purpose of life is the expansion of happiness. Nothing to take seriously in life except the joy of life.

    iMac 4.2 GHZ Intel Core i7, 1TB, SS (2017), OS 10.14

    iMac 3.5 GHz Intel Quad Core i7, 2TB (Mid 2011)
    1 Processor (four real cores and four virtual ones)
    Mac OS 10.9
    16 GB RAM
    After Effects CS5.5, Sound Track Pro 3.0.1, Final Cut Pro 7.0.3, Compressor 3.5.3

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy