Activity › Forums › Adobe After Effects Expressions › rate system
-
rate system
Posted by Aqeel Sami on October 14, 2009 at 4:40 pmwhat is the best way to build a rate system in after effects.I need to show five turned off bulb lights and i want them to be connected to a slider that can have values from 0 to 5 and when the slider has the value of 1 so the first turned off bulb light image changes to another turned on bulb light image and if the slider has the value of 2 then two turned off bulbs are changed to the turned on bulb image and so on. i need a clever idea to do that.any help ? thanks in advance.
Kevin Camp replied 16 years, 6 months ago 3 Members · 6 Replies -
6 Replies
-
Xinlai Ni
October 14, 2009 at 6:39 pmOrganize your comp as the following:
layer 1-5 of 5 turned-on bulb images;
layer 6-10 of 5 turned-off bulb images;
arrange layers so the pairs (1, 6), …, (5, 10) are completely overlapped.
layer 11, control layer with “slider” effect.then copy the following expression to layer 1-5’s opacity property:
sliderValue = thisComp.layer(“Control”).effect(“Slider”)(1);
sliderValue >= index ? 100 : 0then copy the following expression to layer 6-10’s opacity property:
100 – thisComp.layer(index – 5).opacityone catch:
you may have visibility problem if, say bulb 2 image overlaps with bulb 5 images, but normally you wouldn’t.Xinlai Ni
Software Engineer, Google Inc. -
Kevin Camp
October 14, 2009 at 9:29 pmanother way to do it with just one layer (assuming all bulbs are the same) would be to use the cc repetile effect.
first add a slider control, then the cc repetile effect.
add this expression to repetile’s expand right property (or left, down, up, which every way you want the scale to go):
a = effect(“Slider Control”)(“Slider”);
a*width-widthif you use this method, you can also have ‘half’ or partial bulb ratings by entering a decimal in the slider (like 3.5).
if you needed to have values less than 1 bulb, then you could add the linear wipe effect, adjust the angle as needed (based on direction of the scale, right, left, etc.) and add this expression to the transition completion property:
(1-effect(“Slider Control”)(“Slider”))*100
this could also be saved as an animation preset (depending on how often you think you’ll need it).
the pitfall of this method is adjusting the spacing.. the bulb layer will need to have a bit of pad (spacing) built into it, but that can usually be easily achieved by precomping that layer and adjusting the size of the precomp, or the size of the bulb layer within the precomp…
Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW -
Kevin Camp
October 14, 2009 at 10:08 pmone note… if you did use up or down for the scale, you’d probably want to modify the expression to use the height of the layer.
so it would look like this:
a = effect(“Slider Control”)(“Slider”);
a*height-heightKevin Camp
Senior Designer
KCPQ, KMYQ & KRCW -
Aqeel Sami
October 15, 2009 at 6:57 pmsorry guys but can you send me a project file for that because i have some difficulties in achieving your instructions.
-
Aqeel Sami
October 15, 2009 at 7:59 pmthanks guy i tried and succeeded in doing that but how could i increase spaces between every image and what if i wanted to make rating instant not gradual…while changing from 1 to 2 to 3.
-
Kevin Camp
October 15, 2009 at 9:41 pmto increase the space between them, you’ll probably want to put the bulb layer in a precomp (with layer selected, choose layer>pre-compose, choose to ‘leave all attributes’). then scale the bulb layer down a bit within the precomp. this will increase the space around it, thus increasing the spacing between them.
to remove the interpolation between keyframes for the rating slider, select the keyframes for the slider and choose animation>toggle hold keyframes. this will keep each value constant until it hits the next keyframe value.
Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW
Reply to this Discussion! Login or Sign Up