Jump to content

animation controlled by color


tenegger

Recommended Posts

Hi, I want to control an animation range by a color attribute. I want to use attribute transfer of color (black is default, red is the color transferred) so that when the points are black the animation is at frame 1, and when the points get to red the animation is at its endframe.

I have tried some tutorials and got some copy stamped animation on some spheres (see attached file). As the point colors change to red it triggers the animation BUT this will only play through once and never get triggered again, even if the point color returns to red again.

 

I cant figure out how to do this - and I would love the help of some more experienced folk please.

 

thanks from chris

 

sphere_anim_triggered_by_color.hipnc

Link to comment
Share on other sites

I attached a (hopefully) simpler example.

 

I find hscript expressions confusing and odd, chops moreso (powerful yes, but unintuitive). Whenever possible I try and do things in vex/vops, makes more sense to my feeble brain.

 

(edit: tidy up nodes that weren't needed, other things)

stamp_time_v04.hipnc

Edited by mestela
Link to comment
Share on other sites

matt- thanks!

this is great and thanks for adding the notations too. This is laid out most clearly and my feeble brain can just about understand it :)

I have a couple of questions about the wrangle inside the solver- firstly, does "@frame += 1" mean add 1? why is there an equals sign after the plus sign?

secondly, the "if (@Cd.r >1)" why is this asking if red channel is greater than 1? The note says it tests if there is any color - wouldn't this mean testing if Cd.r >0?

I am very new to the syntax in here so please be gentle if you have to explain foundational concepts even if it seems very simple :).

Thanks again, I really appreciate the guidance,

 from chris

Link to comment
Share on other sites

Yep, 'x += 1' is shorthand for ' x = x  + 1', its common to a lot of languages:

 

https://en.wikipedia.org/wiki/Augmented_assignment

 

And yes, that test should probably > 0. If you watch the colour values in the geometry spreadsheet, you'll see the red accumulates to higher than 1 anyway (as it keeps adding onto itself due to the solver sop), so at worst the animation triggers 1 frame behind where the box is. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...