Auto-Scale Content Dynamically in After Effects - Learn AE Expressions

Поділитися
Вставка
  • Опубліковано 28 жов 2019
  • This Adobe After Effects tutorial explains in detail how to apply expressions for scale, to fit or fill content inside the composition boundaries. This technique enables to dynamically scale layers placement in the composition based on content size. This is super helpful if you want to update data in the project with an ease.
    Change content in the project dynamically without any manual work involved and increase your workflow's efficiency.
    #aftereffectstutorial #autoscale #expression # dynamic
    If you want to learn techniques about motion design, expressions and scripting in AE - you are in the right place.
    Follow me to be up to date with whats going to happen next:
    www.tom10.co/tutorials
    / tom10ae
    / tom10videos

КОМЕНТАРІ • 26

  • @alimandi6201
    @alimandi6201 3 роки тому +2

    you are the best, Thank You

  • @anridennko6713
    @anridennko6713 2 роки тому

    SUPER!! Thank You!!!

  • @oladavid1813
    @oladavid1813 3 роки тому +2

    Your video is really helpful I tried copy and paste from your site the first script didn't adjust equally to the new comp but the second adjusted as specified in the video

    • @Tom10
      @Tom10  3 роки тому

      Hey David, could you please explain what exactly didn't worked out? Thanks!

  • @MuhammadNurbasit
    @MuhammadNurbasit 4 роки тому +2

    this is exactly what I need, thank you.
    do you know what's the best way to change images of multiple precomp?
    in my case is a slideshow template.
    1 precomp : 1 image,
    I have 100 precomps with 100 different images
    what I do now is changing the filename

    • @Tom10
      @Tom10  4 роки тому

      Hey Muhammad, thanks for sharing, good to know its useful! The easiest way to achieve images replacement would be to create a script, which does that behaviour automatically - you just import images, define a folder and thats it. But one thing to mention - extendscript knowledge is required - despite of that, I am sure you could find a script online which does this behaviour !

  • @jessicamsun
    @jessicamsun 4 роки тому +2

    Thanks so much for this tutorial Tom! I tried the script but for some reason kept getting this error on line one: "Expression result must be of dimension 2, not 1" Would you happen to know what that may be referring to? And would it be possible to post the script somewhere in the description?
    And looking forward to seeing more of your advance scripting tutorials!

    • @Tom10
      @Tom10  4 роки тому

      Hey Jessica! Sorry for my late reply - most likely in the end of expression you are defining only single value. Try adding variable into the square brackets, and do it for x and y . Thus: [yourScale, yourScale]
      As for the code itself, I will be adding expressions of this kind at www.tom10.co/tutorials !

    • @Tom10
      @Tom10  4 роки тому

      www.tom10.co/post/auto-scale-content-dynamically-in-after-effects

  • @TheWreckedBioscope
    @TheWreckedBioscope 3 роки тому

    Hi Tom10, thanks for the tutorial. It's really helpful. I am relatively new to the world of scripting and due to a project requirement need to impliment this script since this is the most apt for the result I am seeking. However even when I have copied the whole script perfectly in the very first line it keeps giving an error 'ReferenceError:scaleVal is not defined'. Could you please help with this?
    Thanks in advance.

    • @Tom10
      @Tom10  3 роки тому

      Hey, that is strange - but just in case, make sure that this "scaleVal = 100;" is added in the expression as well. As it seems that it might be missing in your expression. Let me know how it goes !

    • @adityasingh-vh3bu
      @adityasingh-vh3bu 3 роки тому +1

      @@Tom10 Hey, Thanks for the help, I had misspelt the "scaleVal =100" that's why wasn't working before. Worked like a charm. Thanks a ton for this. I am a fan for life now.

  • @joshlorenzen
    @joshlorenzen 3 роки тому +1

    I have a question.
    Is it possible to take null tracking data/information from a low proxy comp resolution and scale up that data to fit in a 4K comp and still remain the same perspective as I tracked the footage in the proxy comp..
    Does it make sense? I need the same tracking data to fit in my 4K comp at the same spot as I want my track to stick at

    • @Tom10
      @Tom10  3 роки тому

      Hey Josh, what contents are inside that tracked comp? What you could try to do:
      1. Place proxy comp in 4K comp.
      2. Upscale it to fit 4k comp.
      3. Enable collapse transformation toggle.
      4. Make sure layers in proxy comp has enabled collapse transformation toggles too, as well as all layers inside pre-comps.
      That would be the easiest way of achieving this - it has some cons too, but see if it goes in a correct path and let me know!

    • @joshlorenzen
      @joshlorenzen 3 роки тому

      @@Tom10 I'd loose too much quality doing it that way unfortunately :/ I was just wondering if you could scale up actual NULL tracking information to another comp aspect ratio while still maintaining the same perspectives, dimensions and stuff

    • @Tom10
      @Tom10  3 роки тому +1

      ​@@joshlorenzen this doesn't make full sense, at least from the way I understood (as upscaling replaced proxy with new 4k footage would keep quality in tact with collapse transformation in place)
      Anyways, what you could try to do is the following:
      1. Duplicate your tracking null.
      2. Add a new null into a comp, lets call it master.
      3. Link tracking null to master null.
      4. Copy both nulls into a new comp.
      5. Center align master null
      6. Upscale master null to the ratio difference from proxy comp. so is proxy was 1080p and main comp is 4k - scale it to 200;
      That way, transformations should be maintained, yet I am not sure if that will work pixel perfect for tracking data.

    • @joshlorenzen
      @joshlorenzen 3 роки тому +1

      @@Tom10 Thank you so much for the detailed answers. Will definitely try this method out - maybe it’ll work

  • @themutezone
    @themutezone 4 роки тому +1

    would love to copy your script ;-) love it forever. Can't find it on your website.

    • @Tom10
      @Tom10  4 роки тому +1

      Here you go: www.tom10.co/post/auto-scale-content-dynamically-in-after-effects
      (Apparently the updated version was not published to date!)

    • @themutezone
      @themutezone 4 роки тому +1

      @@Tom10 Fast as lightning, you make my workflow 100x more fun and fast now, best script of a life time.

    • @themutezone
      @themutezone 4 роки тому

      @@Tom10 and now the challenge, to zoom that layer just a bit, so have a zoom in or out incl your script on the Scale.

    • @Tom10
      @Tom10  4 роки тому

      @@themutezone Glad its helpful in some fashion! As to the above thing, here is what I would suggest (yet there are many ways how it could be achieved):
      1. Add a slider controller to a layer.
      2. Define that slider in scale expression alongside other code: scaleDiff = effect("Slider Control")(1);
      3. Then do the following above square brackets: scaleNew = scaleNew + scaleDiff;
      4. Animate slider controller by amout of scale you want to have and.. thats it!

    • @themutezone
      @themutezone 4 роки тому +1

      @@Tom10 again, 10 point for Tom. now I can zoom in over time or just zoom in to the photo when needed. love it.

  • @emilytang492
    @emilytang492 3 роки тому +1

    Can we make this also work with text or shape layer?

    • @Tom10
      @Tom10  3 роки тому +1

      Hey Emily, yes it is possible! With a bit of a twist - instead of checking layer.width and height, sourceRectAtTime should be used to get text/shape's source size!

    • @emilytang492
      @emilytang492 3 роки тому +2

      @@Tom10 Thank you Tom! This is great:)