Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Time remap to change opacity

Community Beginner ,
Feb 15, 2010 Feb 15, 2010

Hello,

I have 25 layers in which i would like to switch between their opacities by means of a time remap marker of sorts..
My idea was to create a comp of all my layers 1-25 (All_Layers), then pre comp this into a Time Remap comp (Final_Comp) to enable their opacities via time remap.
ie: if in the time remap comp (Final_Comp) and type in a value of 1 this would change layer 1 of (All_Layers) comp value to 100%, If i key in frame 4, this would change the value of layer 4 to 100%.
All layers would be 0% until keyed into the time remap value.


I received this expression on another forum compliments of Dan Ebberts,.. Thanks! ( strangely i'm unable to log back into that account to respond.. and no one there to assist me!)

L = comp("Final_Comp").layer("All_Layers");
if (Math.round(L.timeRemap) == index) 100 else 0



Either way, this expression doesn't quite work..

When i copy this into the layers opacity channel.  it indeed sets an initial value of 0%, but the time remap values in my (Final_Comp) do not trigger the appropriate layer opacity change.... they remain 0%.

Any ideas?

Thanks for any help

Jeff

TOPICS
Expressions
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2010 Feb 16, 2010

Ah, so you want a time value of 1 frame to turn on Layer 1, etc. The expression I gave you assumes a time value of 1 second. Here's it is modified for frames:

L = comp("Final_Comp").layer("All_Layers");
if (timeToFrames(L.timeRemap) == index) 100 else 0

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 16, 2010 Feb 16, 2010

Thanks Dan,

I was hoping you'd be stopping by these forums.
Unfortunately,, still can't get this expression to work..  It's yielding some strange results: of a layer turning on off at odd times...


As a test I've created  a simple comp (All_Layers) consisting of 4 layers,  each containing a different solid color.
I created another comp (Final_Comp) and dragged in the (All_Layers) comp. I then set this  up as a time remap, enabling Toggle Hold Key frame at the beginning.
In the (All_Layers) comp  I pasted your expression into each of their opacity channel area,

As mentioned, the expression  sets each of the solid layers to 0% from the start... but then the strangeness begins.

I tried deleting all colored layers but one..  still switches on at odd times.

I'm wondering if each color  layer's expression  will need to be frame specific?  It currently reads as    == index),    perhaps if there's a way to assign an exact frame number for each layer  to be triggered?



I appreciate your taking the time to help me on this.


Jeff

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2010 Feb 16, 2010

Time remapping doesn't seem to update in the Final_Comp the way you would expect. How about scrapping the time remapping idea altogether and use layer markers instead? Apply the layer markers to the All_Layers layer in the Final_Comp and set the comment of the marker to the index (layer number) of the layer that you want to appear at that point. Apply this expression to each layer's (in the All_Layers comp) opacity:

L = comp("Final_Comp").layer("All_Layers");
n = 0;
if (L.marker.numKeys > 0){
  n = L.marker.nearestKey(time).index;
  if (L.marker.key(n).time > time) n--;
}
if (n > 0){
  idx = parseInt(L.marker.key(n).comment,10);
  if (idx == index) 100 else 0;
}else{
  0
}

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 16, 2010 Feb 16, 2010
LATEST

Beautiful!

The markers approach gives a much better view of my settings.

Thanks allot Dan!

... and thanks for the quick response..  very much appreciated

Jeff

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines