Jump to content


Photo

Adding Random Motion Via Expressions


  • Please log in to reply
4 replies to this topic

#1 pixelweave

pixelweave

    Piglet

  • Adv Members
  • 3 posts

Posted 20 April 2009 - 01:11 AM

Hi,

I'm new to Fusion, and I'm a bit confused as to how to implement expressions. I'm working on a biomedical animation, where I'm trying to add some random motion to several molecules via their transform tool(s). I'm specifically trying to apply the rand function to the Center attribute, and the the sin function to the Angle attribute. Can anyone point me in in the right direction as to how something like this is done? I've tried the following (which is loosely based from my knowledge of writing expressions in Maya), but it didn't work. Am I completely off track? Are using expressions the best way to achieve this?

Transform1.translateX = rand(0,5) + 1


Thanks!

#2 shaily

shaily

    Flying Pig

  • Adv Members
  • PipPipPipPipPip
  • 380 posts

Posted 20 April 2009 - 03:03 AM

Transform1.translateX = rand(0,5) + 1


hi pixelweave,

try
Point(random(0,.5)+1,.5)

ill ellaborate if needed.
also i changed five to point five, five will make sure your point of interest is almost always out of the visible frame area.

shaily.

#3 Robert Zeltsch

Robert Zeltsch

    Member Pig

  • Adv Members
  • PipPip
  • 24 posts

Posted 20 April 2009 - 03:10 AM

Hi,

You have several options:

A: You want to randomize a desired motion by defining a range
1. Right click on the center and select "Modify With/Shake"
2. In the modifiers Tab of the Transform a Shake tool appears. This will control your Center Point now.
3. In this modifier deactivate the Lock X/Y Option
4. Now you can animate the X-min/max and Y-min/max to layout an overall motion for your molecule
5. The Shake modifier randomizes the values between the animated min/max bounds, while keeping a coherent curve. Use "Smoothness" and "Random seed" to control the characteristic of this curve (You can watch in Spline View how the curve behaves over time)

B: You want an absolute random behavior of the motion, like jittering.
1. Right click on the center and select "Modify With/Expression"
2. Like the Shake tool in example A, an expression modifier appears in the modifer tab.
3. It has several point and number inputs (in the Controls Tab) and two Tabs for the output. Since your want to modify a point parameter (the Center of the Transform) use the "Point Out" Tab. There are two expression fields, one for each axis.
4. Here you can enter expressions using the following syntax vfxpedia - expression
5. Use rand(x,y) or rands(x,y,s). (You may want to animate the s(eed) parameter in the second one.

C: You have thousands (or only 1 ?) molecules so you want a particle system
1.Follow the Bitmap based Particles tutorial to setup and control a particle system using bitmap sprites.
2. Adapt it to your needs. You can also create a 3D particle system with Fusions 3d space.
3. Have Fun... :)

I hope this will help you.

#4 pixelweave

pixelweave

    Piglet

  • Adv Members
  • 3 posts

Posted 20 April 2009 - 07:35 AM

Hi,

You have several options:

A: You want to randomize a desired motion by defining a range
1. Right click on the center and select "Modify With/Shake"
2. In the modifiers Tab of the Transform a Shake tool appears. This will control your Center Point now.
3. In this modifier deactivate the Lock X/Y Option
4. Now you can animate the X-min/max and Y-min/max to layout an overall motion for your molecule
5. The Shake modifier randomizes the values between the animated min/max bounds, while keeping a coherent curve. Use "Smoothness" and "Random seed" to control the characteristic of this curve (You can watch in Spline View how the curve behaves over time)

B: You want an absolute random behavior of the motion, like jittering.
1. Right click on the center and select "Modify With/Expression"
2. Like the Shake tool in example A, an expression modifier appears in the modifer tab.
3. It has several point and number inputs (in the Controls Tab) and two Tabs for the output. Since your want to modify a point parameter (the Center of the Transform) use the "Point Out" Tab. There are two expression fields, one for each axis.
4. Here you can enter expressions using the following syntax vfxpedia - expression
5. Use rand(x,y) or rands(x,y,s). (You may want to animate the s(eed) parameter in the second one.

C: You have thousands (or only 1 ?) molecules so you want a particle system
1.Follow the Bitmap based Particles tutorial to setup and control a particle system using bitmap sprites.
2. Adapt it to your needs. You can also create a 3D particle system with Fusions 3d space.
3. Have Fun... :)

I hope this will help you.



Thanks! all of your suggestions work wonderfully, especially B.

#5 pixelweave

pixelweave

    Piglet

  • Adv Members
  • 3 posts

Posted 20 April 2009 - 07:51 AM

Transform1.translateX = rand(0,5) + 1


hi pixelweave,

try
Point(random(0,.5)+1,.5)

ill ellaborate if needed.
also i changed five to point five, five will make sure your point of interest is almost always out of the visible frame area.

shaily.


Thanks! This worked as well.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users