Activity › Forums › Adobe After Effects Expressions › mimicking AppleDock with expressions
-
mimicking AppleDock with expressions
Posted by Jetcityj on February 27, 2007 at 7:55 pmCouldn’t find any posts related to this problem, so hopefully I am not repeating…
So the problem at hand is that I have a row of icons that are scaling up based on their position to a Null but the images scaling is covering up the icons to the left and right of it. What I would like to have is the icons to the left and right of the scaled icon(s) to move from under it and the subsequent icons down the line to adjust their position in smaller and smaller amounts.
Thanks,
JetcityJMylenium replied 19 years, 2 months ago 3 Members · 7 Replies -
7 Replies
-
Mylenium
February 28, 2007 at 6:19 amWell, multiply the X position by the scale factor. Dunno your specific setup, but if you already are using a Null and one of the keyframe methods like ease(), it could be something as simple as this:
pos_offset=100; //maximum maximum offset
pos_factor=thisLayer.scale[0]/100; //X scale of same layer//decide whether the current icon is before or after the largest icon and move in the right direction
if (scale[0] < thisComp.layer(index+1).scale[0] {pos_direction = -1} else {pos_directrion = 1}; pos_new=position[0]+pos_factor*pos_offset*pos_direction; [pos_new,position[1]]
The only condition for the code to work is that your layers are stacked neatly in the right order because it uses the index to determine the direction in which to move.
Mylenium
[Pour Myl
-
Mylenium
February 28, 2007 at 6:20 amWell, multiply the X position by the scale factor. Dunno your specific setup, but if you already are using a Null and one of the keyframe methods like ease(), it could be something as simple as this:
pos_offset=100; //maximum maximum offset
pos_factor=thisLayer.scale[0]/100; //X scale of same layer//decide whether the current icon is before or after the largest icon and move in the right direction
if (scale[0] < thisComp.layer(index+1).scale[0]) {pos_direction = -1} else {pos_direction = 1}; pos_new=position[0]+pos_factor*pos_offset*pos_direction; [pos_new,position[1]]
The only condition for the code to work is that your layers are stacked neatly in the right order because it uses the index to determine the direction in which to move.
Mylenium
[Pour Myl
-
Jetcityj
February 28, 2007 at 4:05 pmThanks Mylenium,
That is definitely on the right track but the icons seem to jump to their new positions instead of “sliding”. Any ideas on how to get the sliding factor?
I am still very new to the expression coding so I will see if I can build off yours to get what I need. Off to Motionscript to start the learning process…Thanks again,
JetcityJ -
Mylenium
February 28, 2007 at 5:45 pmMay be due to the way the scale is calculated in the first place. The range that triggers the icon to scale may be to small. In that case you’d simply have re-use the code you are using there and modify the trigger distance. You might even have to use a second Null object.
Mylenium
[Pour Myl
-
Colin Braley
February 28, 2007 at 8:05 pmIf you post the expression you are using for scale people will probably be able to help you out more.
~Colin -
Jetcityj
March 1, 2007 at 2:19 amthis is a Frankenstein version of another expression I found on this forum.
BaseSize = thisComp.layer(“Scale #s”).effect(“Base size”)(“Slider”)
maxScale = thisComp.layer(“Scale #s”).effect(“Enlarge size”)(“Slider”)
MaxDist = thisComp.layer(“Scale #s”).effect(“MaxDist”)(“Slider”)
d = toWorld(anchorPoint) – thisComp.layer(“scaling Null”).toWorld([0,0]);
distance=length(d);
linear(distance, 0, MaxDist, [maxScale, maxScale], [BaseSize, BaseSize]);so the top 3 lines are just Expression Sliders so I quickly fine-tune certain variable amounts
MaxDist=distance in pixels to begin scaling
maxScale=largest percentage to scale item
BaseSize=starting out sizehttps://headsquared.com/temp/AppleDock_v01.mov
I was working on a hi-bred of this expression and the one Mylenium offered up but nothing concrete yet…
Thanks,
JCJ -
Mylenium
March 1, 2007 at 10:15 amJust use the
d = toWorld(anchorPoint) – thisComp.layer(“scaling Null”).toWorld([0,0]);
distance=length(d);
linear(distance, 0, MaxDist, [maxScale, maxScale], [BaseSize, BaseSize]);to determine a offset factor. modify it to fit in the other stuff and you’re good to go:
MaxDist=200;d = toWorld(anchorPoint) – thisComp.layer(“scaling Null”).toWorld([0,0]);
distance=length(d);
pos_offset=linear(distance, 0, MaxDist, 0, 100]);//decide whether the current icon is before or after the largest icon and move in the right direction
if (scale[0] < thisComp.layer(index+1).scale[0]) {pos_direction = -1} else {pos_direction = 1}; pos_new=position[0]+pos_offset*pos_direction; [pos_new,position[1]]
Mylenium
[Pour Myl
Reply to this Discussion! Login or Sign Up