Notifications
Clear all

[Closed] keyframe cumulation value

Hey,
just creating a visibility track utility. One value spinner for the transition duration, on button “fade in” and another button “fade out”. Keyframes are created at currentTime.
Works fine individually, but when adding a fade out few frame after a fade in the first created keys are drop down in negatives value. I cant understand why…
Any help?

rollout army “FadeIn&Out”
(
spinner duree “Duration:” type:#integer range:[0,10000,10]
button fadin”Fade In”width:140 height:25
button fadout “Fade Out”width:140 height:25
button btnreset “Reset ” width:140 height:15

on fadout pressed do
(
for o in selection do
(o.visibility = linear_float()
with animate on
(
at time (currentTime) o.visibility.controller.value = 1
at time (currentTime+duree.value) o.visibility.controller.value = 0
selectKeys o.visibility.controller 0 0f
deleteKeys o.visibility.controller #selection
)
)
)

     on fadin pressed do
 (
 for o in selection do
     (o.visibility = linear_float() 
         with animate on
         (
             at time (currentTime) o.visibility.controller.value = 0
             at time (currentTime+duree.value) o.visibility.controller.value = 1
             selectKeys o.visibility.controller 0 0f
             deleteKeys o.visibility.controller #selection
         )
     )
 )
 
 on btnreset pressed do
 (
 for o in selection do
         (
         o.visibility = linear_float()
         selectKeys o.visibility.controller 0 10000f
         deleteKeys o.visibility.controller #selection
         o.visibility.controller.value = 1
         )
 )

)
createDialog army

2 Replies

its because you are applying linear_float() to the visibility every time in the loop. Just replace the assignment of linear_float with:


--o.visibility = linear_float() -- replace this with
try (classof(o.visibility.controller))catch( o.visibility = linear_float())

thank you, you are right