{"id":325,"date":"2017-09-19T13:00:17","date_gmt":"2017-09-19T18:00:17","guid":{"rendered":"http:\/\/ciraldo.stream\/uwm-vfx2\/?page_id=325"},"modified":"2017-09-19T18:23:36","modified_gmt":"2017-09-19T23:23:36","slug":"expressions-p1","status":"publish","type":"page","link":"https:\/\/ciraldo.stream\/uwm-vfx2\/topics\/expressions-p1\/","title":{"rendered":"Expressions Take 1"},"content":{"rendered":"<h1>Basic Expressions &amp; Expression Controls<\/h1>\n<p>Links: [<a href=\"https:\/\/ciraldo.stream\/uwm-vfx2\/topics\/expressions-p1\/\">Lecure Outline<\/a>] [<a href=\"https:\/\/ciraldo.stream\/uwm-vfx2\/topics\/expressions-p1\/lab\/\">Lab Exercise<\/a>] [<a href=\"https:\/\/ciraldo.stream\/uwm-vfx2\/topics\/expressions-p1\/homework\/\">Homework<\/a>]<\/p>\n<p>On <strong>each frame<\/strong> of a comp, AE looks at the <strong>values<\/strong> of each layer&#8217;s\u00a0<strong>properties<\/strong> (position, scale, rotation, etc.) to determine how to display them\u00a0<strong>at that moment in time.<\/strong><\/p>\n<p><strong>Also<\/strong> on each frame, AE checks to see if there are any <strong>expressions<\/strong> enabled for any properties. (For example, perhaps a layer&#8217;s <strong>scale<\/strong> property has an expression enabled.)<\/p>\n<h2>Expressions<\/h2>\n<p>In After Effects, an\u00a0<strong>expression<\/strong>\u00a0is a simple bit of <strong>script<\/strong> that is <strong>attached to some property<\/strong>, and which gets <strong>carried out on every frame<\/strong>. The <strong>result of the expression<\/strong> is then used instead of the <strong>original value of the property<\/strong>. This can be used to tie unrelated properties together (with optional math thrown in.)<\/p>\n<h2>Expression Script<\/h2>\n<p>An <strong>expression\u00a0script<\/strong> is like a simple<strong>\u00a0to-do list<\/strong> for AE to carry out, or &#8220;execute&#8221; at each frame. \u00a0<\/p>\n<p>Each item on the list is like a <strong>command<\/strong> for AE to do.<\/p>\n<p>Commands<span style=\"font-size: 1rem;\"> on the to-do list are <\/span><strong style=\"font-size: 1rem;\">separated with semi-colons.<\/strong><\/p>\n<p>The\u00a0<strong>last item<\/strong> on the to-do list is used to determine the <strong>result of the expression<\/strong>.<\/p>\n<p>The <strong>expression result<\/strong> is used for the <strong>final property value<\/strong>.<\/p>\n<p>Often times expression scripts are <strong>only 1 line long.<\/strong><\/p>\n<h2>Enabling Expressions<\/h2>\n<p>To <strong>enable expressions<\/strong> for a property, <strong>option-click the stopwatch icon<\/strong> for that property. Once enabled, a text field will be available for entering the expression script:<\/p>\n<figure id=\"attachment_330\" aria-describedby=\"caption-attachment-330\" style=\"width: 427px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-330 size-full\" src=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.16.18.png\" alt=\"Expression enabled for the Position property of the Purple Solid\" width=\"427\" height=\"184\" srcset=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.16.18.png 427w, https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.16.18-300x129.png 300w\" sizes=\"auto, (max-width: 427px) 100vw, 427px\" \/><figcaption id=\"caption-attachment-330\" class=\"wp-caption-text\">Expression enabled for the Position property of the Purple Solid<\/figcaption><\/figure>\n<p>The text area for the expression can be enlarged to display multiple lines:<\/p>\n<figure id=\"attachment_332\" aria-describedby=\"caption-attachment-332\" style=\"width: 431px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-332 size-full\" src=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.19.41.png\" alt=\"\" width=\"431\" height=\"215\" srcset=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.19.41.png 431w, https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.19.41-300x150.png 300w\" sizes=\"auto, (max-width: 431px) 100vw, 431px\" \/><figcaption id=\"caption-attachment-332\" class=\"wp-caption-text\">An expression with multiple lines<\/figcaption><\/figure>\n<p>(Lines that start with two slashes are ignored by AE and used for descriptive comments.)<\/p>\n<h2>Writing Specific Values<\/h2>\n<p>Some properties have values that are <strong>simple numbers<\/strong>, such as <strong>rotation.<\/strong> You can enable expressions for the rotation property and enter a specific value like so:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-334\" src=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.25.36.png\" alt=\"\" width=\"345\" height=\"96\" srcset=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.25.36.png 345w, https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.25.36-300x83.png 300w\" sizes=\"auto, (max-width: 345px) 100vw, 345px\" \/><\/p>\n<p>This is a script that is only <strong>one line long<\/strong> and whose <strong>last (and only) item is the number 45.8<\/strong>. So AE uses that value for the rotation property on every frame.<\/p>\n<p>Other properties have values that are more complex than simple numbers, such as <strong>position.<\/strong> Position values are written using square-brackets like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-335\" src=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.29.09.png\" alt=\"\" width=\"379\" height=\"93\" srcset=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.29.09.png 379w, https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.29.09-300x74.png 300w\" sizes=\"auto, (max-width: 379px) 100vw, 379px\" \/><\/p>\n<h2>Referring to Other Property Values<\/h2>\n<p>You can refer to <strong>values of other properties<\/strong> with their script name, which is a little bit like a backwards street address:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-338\" src=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.37.15.png\" alt=\"\" width=\"728\" height=\"115\" srcset=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.37.15.png 728w, https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.37.15-300x47.png 300w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><\/p>\n<p>In other words, it&#8217;s a bit like writing <strong>&#8220;USA, Wisconsin, Milwaukee, Kenwood Blvd., 12345, Office #3&#8221;<\/strong>.<\/p>\n<p>You can type in a property name manually, or there are some ways to have AE help save time. Pick whip. Copy with Links.<\/p>\n<h2>Expression Controls<\/h2>\n<p>These are a <strong>special type of effect<\/strong> that can help add some behind-the-scenes user-interface to more complex projects. (They do nothing visually or otherwise on their own, but are often controlled or referred to with <strong>expressions<\/strong>.)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-337\" src=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.33.42.png\" alt=\"\" width=\"402\" height=\"164\" srcset=\"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.33.42.png 402w, https:\/\/ciraldo.stream\/uwm-vfx2\/wp-content\/uploads\/2017\/09\/Screenshot-2017-09-19-16.33.42-300x122.png 300w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Basic Expressions &amp; Expression Controls Links: [Lecure Outline] [Lab Exercise] [Homework] On each frame of a comp, AE looks at the values of each layer&#8217;s\u00a0properties (position, scale, rotation, etc.) to determine how to display them\u00a0at that moment in time. Also on each frame, AE checks to see if there are any expressions enabled for any &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ciraldo.stream\/uwm-vfx2\/topics\/expressions-p1\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Expressions Take 1&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":71,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-325","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-json\/wp\/v2\/pages\/325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-json\/wp\/v2\/comments?post=325"}],"version-history":[{"count":11,"href":"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-json\/wp\/v2\/pages\/325\/revisions"}],"predecessor-version":[{"id":349,"href":"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-json\/wp\/v2\/pages\/325\/revisions\/349"}],"up":[{"embeddable":true,"href":"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-json\/wp\/v2\/pages\/71"}],"wp:attachment":[{"href":"https:\/\/ciraldo.stream\/uwm-vfx2\/wp-json\/wp\/v2\/media?parent=325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}