Help with creating a fake mouse over and click cursor

Scripting for After Effects

Help with creating a fake mouse over and click cursor

Postby shootingpandas on 01/16/2014, 9:55 am

Hello everybody,

this is my first post and I start it off with some search for advice. So thank you all in advance!

I'm trying to recreate a fake website animation and I'm animating the mouse cursor manually at the moment. What I would like to have is some easy way to create a mouse over effect for the cursor itself. Basically what I need is to switch from the arrow to the hand symbol. And maybe even create a small bouncy scaling effect on a fake click to make the clicking more visual.

Right now I'm working with two (whip-linked) layers and changing the opacity and scaling whenever I need it by hand through keyframes. But is there maybe a way to aid this process with a script or any other method?

I guess I'm looking for the easy way out ;)
Any help is very much appreciated! Thank you, everyone!
shootingpandas
 
Posts: 3
Joined: 01/16/2014, 9:40 am

Re: Help with creating a fake mouse over and click cursor

Postby kyletmartinez on 01/16/2014, 1:11 pm

As with all projects there are multiple ways to do it although I am not sure if there is an "easy way out."

The more complicated way is to set up a collision detection expression using Dan Ebbert's MotionScript site. You can find a link here: http://www.motionscript.com/design-guide/collision.html

The second way is easier. Animate a null object as your mouse. Then parent an arrow layer and a hand layer to the null so they are always following. Manually keyframe opacity on each layer from there.
kyletmartinez
 
Posts: 581
Joined: 10/30/2013, 6:53 am
Location: Phoenix
Twitter: kyletmartinez

Re: Help with creating a fake mouse over and click cursor

Postby Michael_Szalapski on 01/16/2014, 4:01 pm

kyletmartinez wrote:Manually keyframe opacity on each layer from there.

I'd suggest using hold keyframes instead of interpolated keyframes. It's more realistic and you only have to do one keyframe per layer at the transition points. (Although, I bet you could use a linear expression to make the hand be 100% when the pointer is 0% and 0% when it's 100% so you only have to do keyframes on the pointer layer.)
______________
Michael Szalapski
Fast. Cheap. Good.
Pick two.
Michael_Szalapski
 
Posts: 8275
Joined: 02/2/2010, 1:06 pm
Location: Nashville, TN, USA
Twitter: thegreatszalam

Re: Help with creating a fake mouse over and click cursor

Postby kyletmartinez on 01/16/2014, 4:02 pm

Michael_Szalapski wrote:Although, I bet you could use a linear expression to make the hand be 100% when the pointer is 0% and 0% when it's 100% so you only have to do keyframes on the pointer layer


Nice! Even an if statement would work as well.
kyletmartinez
 
Posts: 581
Joined: 10/30/2013, 6:53 am
Location: Phoenix
Twitter: kyletmartinez

Re: Help with creating a fake mouse over and click cursor

Postby shootingpandas on 07/16/2015, 11:29 am

Thank you guys for your help!

I noticed that I never followed up with what I did in the end. Sorry about that. But I thought I'd come back and show my appreciation by posting what I did. Maybe it'll help somebody else in future projects.

I adapted the incredible Dan Ebbert's marker-sync expression:
http://www.motionscript.com/design-guid ... -sync.html
The expression below is a bit different than the one on his site, to make the animations act out completely.


Here's what I did in detail:

I created a tiny18x19px composition in which I created the different versions of the pointer (arrow, hand, hand-click, text, text-click, drag hand, drop hand). Not that it really matters, but just for visibility I spaced these 2 seconds apart. The click animations themselves are only a few frames long. The top layer is a Null Object with a marker at the beginning of each pointer state/ animation and an abbreviated label I can easily remember ("arr", "hnd", "clc", "txt", "txtclc", "drg" and "drp") so that I don't have to type a whole lot when calling it up.

Then you I dropped the pointer composition into the website composition, activated time remapping and pasted the following expression into the time remap sublayer.

Now the animation and pointer state is quickly and easily called up by creating a marker on that comp layer, labelling it with the state or animation you want to call up ("arr", "hnd", "clc", "txt", "txtclc", "drg" and "drp"). Just make sure they are spelled exactly as they are inside of the composition.


Code: Select all
action = comp(name).layer("action");

n = 0;
if (marker.numKeys > 0){
  n = marker.nearestKey(time).index;
  if (marker.key(n).time > time){
    n--;
  }
}

if (n == 0){
  0
}else{
  m = marker.key(n);
  myComment = m.comment;
  t = time - m.time;
  try{
    actMarker = action.marker.key(myComment);
    if (action.marker.numKeys > actMarker.index){
      tMax = action.marker.key(actMarker.index + 1).time - actMarker.time - thisComp.frameDuration;
    }else{
      tMax = action.outPoint - actMarker.time;
    }
    t = Math.min(t, tMax);
    actMarker.time + t;
  }catch (err){
    0
  }
}
shootingpandas
 
Posts: 3
Joined: 01/16/2014, 9:40 am

Re: Help with creating a fake mouse over and click cursor

Postby Michael_Szalapski on 07/16/2015, 12:49 pm

Nice! Thanks for the followup!
______________
Michael Szalapski
Fast. Cheap. Good.
Pick two.
Michael_Szalapski
 
Posts: 8275
Joined: 02/2/2010, 1:06 pm
Location: Nashville, TN, USA
Twitter: thegreatszalam


Return to After Effects Expressions

cron