Notifications
Clear all

[Closed] Basic animation/Keyframe scripting

Hi all,

I’m getting addicted to this maxscript stuff, so handy! But alas I’m still new

So I’m trying to create a button to automatically generate a simple animation for some cartoony eyes blinking

So the logic is.

Create a keyframe at frame 0
Create a keyframe at frame 15, scaling locally on the Y Axis by 50%
Creating a keyframe at frame 30, scaling back up to the original size.

However I am having problems, for one it scales on the wrong axis, I have used the maxscript listener to check what code to use and use the same code.

The other problem is that it doesn’t scale back up at frame 30??

What am I doing wrong or is there a better way?

Heres what I have

toolMode.coordsys #local
with animate on
(

at time 0 scale $ [1,1,1]
at time 15 scale $ [1,0.5,1]
at time 30 scale $ [1,1,1]
)
Any help appreciated.
Thanks

4 Replies
1 Reply
(@lucpet)
Joined: 11 months ago

Posts: 0

This worked for me.
To see what was going on with your script take a look at the Curve Editor

toolMode.coordsys #local
Eye = sphere radius:15 segments:32 name:"Eye"
converttopoly Eye

with animate on
(
	at time 0 Eye.scale.z = 1.0
	at time 15 Eye.scale.z = 0.5
	at time 30 Eye.scale.z = 1.0
)

toolMode.coordsys #local
Eye = sphere radius:15 segments:32 name:"Eye"
converttopoly Eye
select Eye
maxops.setDefaultTangentType #step #step
animationRange = interval 0 10
timeConfiguration.playbackLoop = true
with animate on
(
	at time 0 Eye.scale.z = 1.0
	at time 5 Eye.scale.z = 0.5
	at time 10 Eye.scale.z = 1.0
)
playAnimation immediateReturn:true

Hey Lucpet!

Thanks! For both posts I was out and eager to try it

Thanks for the script too, its awesome to learn practically bit by bit, it really sticks once I’ve used something practically…

Can I just ask what does the “maxops.setDefaultTangentType #step #step” line do? is this global or specific to the current animation keys.

I’ve been looking around keyframe stuff, is there code to do it “At current frame”, so it creates the animation at the current frame so say I have a 400 timeframe animation I select the eyes forward to where I want the blinks, execute the script and then it creates the changes from there.

So much to learn but I am starting to enjoy it…thank God for sharing people as well, it really helps!

1 Reply
(@lucpet)
Joined: 11 months ago

Posts: 0

“maxops.setDefaultTangentType #step #step” sets the tangents to step so the blink is either on or off as opposed to a gradual close and gradual open.
There is a pop up on the bottom of max near the time configuration where you can set the default tangents normally it is set to Auto (I think) But the code allows you to adjust how the blink happens so it could for example close slowly and open quickly or any variation of animation.
Highlight the code in max and hit f1 and it should take you to the possible types #linear #auto etc in maxscript.

If you haven’t done so check out www.Scriptspot.com for plenty of scripts to pull apart, also the forum is a good place to spend some time there as well.
Good luck, glad I could help a bit.