NoSleepCreative Wiki
  • Welcome to NoSleepCreative
  • After Effects
    • Getting Started with Expressions
    • Expressions & Snippets
      • JSX Cheatsheet
      • Expression Troubleshooting
      • Utilities
      • Shape & Mask
      • Type & Text
    • Cookbook
      • Algorithmic
      • Random properties
      • Harmonic Motion
      • Staggering
      • Tessellation & Tiling
      • Type animators
      • Speed lines
      • Radial Array
      • Orb & Trails
      • Shading & Texturing
      • Responsive
      • Automation
      • Setup & Rigs
    • Getting started with Scripting
    • Scripting
      • Utilities
      • Master Properties
    • ScriptUI
  • Studio Ops
    • Tooling
    • Toolkitting
    • Knowledge Base
    • Naming Convention
    • DAM
  • Cinema 4D
    • Formulas
    • Python Cheat Sheet
      • For Artists
      • Maya Environment
      • Maya snippets
      • VSFX 705
    • Cookbook
  • Info
    • About
    • Portfolio
    • Course
    • YouTube
    • Gumroad
    • GitHub
  • Dev
    • archive
      • Webscraping
      • Google Sheets Formulas
      • SQL
      • Terminal
      • C++
      • Unreal Engine
      • Concert Visualization
      • Dome-projection
      • UI UX
      • Professional Etiquettes
      • Woes
      • How to get better
        • Portfolio / Showreel
        • Design with cooking
      • Media theories
        • Post Cinematic Affect
        • Marxism, Reproduction and Aura
        • Heuristics & Authorship
        • 02 Semiotics
        • 3 Process?
        • 05
        • 06 Technology & Mediation
        • Formalism
        • Simulation
        • The Gaze & Media Critique
        • Import
        • 10-12
      • Recommended books
        • 🔴Things I learned
      • Mac Superuser
        • Applescript
      • InDesign
      • Illustrator
      • Blender
      • Premiere Pro
      • Mathematics
        • Probability
        • Linear Algebra
      • Shader Dev
      • Getting Started with After Effects
        • Best Practices
        • Pimping up AE
        • Environment
      • Houdini
        • Cheatsheet
        • Cookbook
        • Techniques
        • Dynamic
        • Rendering & Lighting
        • Animation
        • Particles
        • Others
          • Modeling
          • Fluids - Pyro & Smoke
          • Rendering
      • REGEX
    • Sandbox
      • Nexrender
        • Terminology
        • Project Files Preparation
Powered by GitBook
On this page
  • Spreadsheet to text layers
  • Spreadsheet to compositions
  • Normalize width of layers
  • Normalizing image/logo sizes based on sampling alpha

Was this helpful?

  1. After Effects
  2. Cookbook

Automation

PreviousResponsiveNextSetup & Rigs

Last updated 4 years ago

Was this helpful?

Spreadsheet to text layers

  • Refer to CoMotion 2021 title sequence

Spreadsheet to compositions

Normalize width of layers

nominalValue/width∗100nominalValue/width*100 nominalValue/width∗100
nominal = 100
offset = 900; // connect to slider control
threshold = 0;
//
swidth = thisLayer.sourceRectAtTime().width;

svalue = nominal/swidth;
*

// conditional 
if(swidth>threshold){
    [svalue,svalue,svalue]*offset
}
logo=thisLayer.source.layer(thisLayer.source.numLayers);
sHeight=height/logo.height;
sWidth=width/logo.width;
s=Math.min(sHeight,sWidth);
value*s
normalizedScale=value∗(nominalValue/width)normalizedScale = value*(nominalValue/width)normalizedScale=value∗(nominalValue/width)
nominalWidth = 200;
leftEdge = 0;

for (i = 0; i <= width; i++){
  temp = sampleImage([i,height/2],[0.5,height/2],true,time);
  if (temp[3] > 0){
    leftEdge = i;
    break;
  }
}

rightEdge = width-1;

for (i = width-1; i >= 0; i--){
  temp = sampleImage([i,height/2],[0.5,height/2],true,time);
  if (temp[3] > 0){
    rightEdge = i;
    break;
  }
}
value*nominalWidth/(rightEdge-leftEdge+1)
// cacheCompareSamplesPerSecond 0
nominalHeight = 200;
topEdge = 0;
for (i = 0; i <= height; i++){
  temp = sampleImage([width/2,i],[width/2,0.5],true,time);
  if (temp[3] > 0){
    topEdge = i;
    break;
  }
}
bottomEdge = height-1;
for (i = height-1; i >= 0; i--){
  temp = sampleImage([width/2,i],[width/2,0.5],true,time);
  if (temp[3] > 0){
    bottomEdge = i;
    break;
  }
}

alphaheight = (bottomEdge-topEdge+1); // in pixels 
value*nominalHeight/alphaheight*100/value[1]
// for logos that are symmetrical
//nominal values;
n1 = 200;
n2 = 400;
n3 = 800;

topEdge = 0;
for (i = 0; i <= height; i++){
  temp = sampleImage([width/2,i],[width/2,0.5],true,time);
  if (temp[3] > 0){
    topEdge = i;
    break;
  }
}

leftEdge = 0;

for (i = 0; i <= width; i++){
  temp = sampleImage([i,height/2],[0.5,height/2],true,time);
  if (temp[3] > 0){
    leftEdge = i;
    break;
  }
}
=
aRatio = leftEdge/topHeight;
if(aRatio<1.1){value*n1/leftEfge

based on sampling alpha

Normalizing image/logo sizes
Expressions comment to prevent calculations on every frame
https://aescripts.com/auto-crop/