Notifications
Clear all

[Closed] animating gradient ramp

 em3

Hello, from what I have read so far throughout this thread it is not possible to animate the Flag__x position of a gradient ramp with maxscript. Is that accurate?

2 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Not true. You can animate the position of existing flags (starting with flag 3 which is not at the end of the gradient), but the creation of new flags is problematic.

Here is an example:

theTeapot = teapot() --create a teapot
theMat = standard() --create a material
theMap = Gradient_Ramp() --create a gradient 
theMat.diffusemap = theMap --assign the gradient as diffuse
theTeapot.material = theMat --assign the material to the teapot
meditMaterials[1] = theMat --show the material in MEdit slot 1
--Animate the Position of the 3rd flag on frame 100 to 70 and the color to red
with animate on at time 100 
(
  theMap.Gradient_Ramp.Flag__3.position = 70
  theMap.Gradient_Ramp.Flag__3.color = red
)
showTextureMap theMat theMap true --display in viewports

 em3

ahhh, thanks Bobo. I was doing all my testing on flags 1 and 2


 q.Gradient_Ramp.flag__1.position = [0,50,0]
 -- Unknown property: "position" in ReferenceTarget:ReferenceTarget
 

thanks a lot!

edit: The integer must be a percentage. I have a “wave” modifier moving across a plane and would like the gradient ramp flags to follow it’s position which I am getting with:


with animate on ( at time 60 ( w.gizmo.pos.y = a.max[2] ))
with animate on ( at time 1 ( w.gizmo.pos.y = a.min[2] ))

so, to make sure the texture wiping on stays with the curve of the wave, I need to find the percentage of the keyframe relative to length of the wave animation…I think. Maybe that is for another thread though.