# Scale Scalar Value in Animation

**URL:** https://discourse.paraview.org/t/scale-scalar-value-in-animation/11540
**Category:** ParaView Support
**Created:** [March 1, 2023, 9:13am UTC](https://discourse.paraview.org/t/scale-scalar-value-in-animation/11540 "2023-03-01T09:13:07Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![reox](https://discourse.paraview.org/user_avatar/discourse.paraview.org/reox/32/16237_2.png) [@reox](https://discourse.paraview.org/u/reox)
#### Post date: [March 1, 2023, 9:13am UTC](https://discourse.paraview.org/t/scale-scalar-value-in-animation/11540/1 "2023-03-01T09:13:07Z")

</div>

I want to animate the deformation of a mesh, containing also a scalar value for each cell.  
Basically, I want to scale the deformation as well as the scalar value from 0 to 1 times the value.  
As an extra difficulty, I need to scale the scalar value actually by the square of the scale factor.

The animation of the deformation is straight forward using the Warp by Vector filter and using the Scale factor in the animation pane.  
However, for the scalar value I have not found a solution yet. I know I can scale it using the Calculator filter, but how can I set a scaling factor that can be used in the animation pane?  
I noticed there is this “Replacement Value”, I can also use in the animation, but how does this work?

---

<div class="post-metadata">

### Author: ![reox](https://discourse.paraview.org/user_avatar/discourse.paraview.org/reox/32/16237_2.png) [@reox](https://discourse.paraview.org/u/reox)
#### Post date: [March 7, 2023, 9:03am UTC](https://discourse.paraview.org/t/scale-scalar-value-in-animation/11540/2 "2023-03-07T09:03:57Z")

</div>

I can probably write a script that creates several files that contain “timesteps” where this scalar value is scaled. But is there no other way to animate that directly in paraview?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 8, 2023, 1:43pm UTC](https://discourse.paraview.org/t/scale-scalar-value-in-animation/11540/3 "2023-03-08T13:43:22Z")

</div>

You can just animate it using the AnimationView.

---

<div class="post-metadata">

### Author: ![reox](https://discourse.paraview.org/user_avatar/discourse.paraview.org/reox/32/16237_2.png) [@reox](https://discourse.paraview.org/u/reox)
#### Post date: [March 8, 2023, 1:50pm UTC](https://discourse.paraview.org/t/scale-scalar-value-in-animation/11540/4 "2023-03-08T13:50:40Z")

</div>

But how? As said, the warp by vector is trivial.  
But what about scaling a scalar value?  
What I want is that while the deformation gets larger and larger, also the scalar value (which is used to colorize the mesh elements) gets larger and larger, i.e., the color should change accordingly.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [March 8, 2023, 7:52pm UTC](https://discourse.paraview.org/t/scale-scalar-value-in-animation/11540/5 "2023-03-08T19:52:00Z")

</div>

Since you want to change the “Function” property on the `Calculator` filter, you are better off using the “Python” animation track.

In the **Animation View** ,add a new Python track by choosing “Python” in the combo-box next to the `+` and use the following script as guide:

```python
def start_cue(self): pass

def tick(self):
  from paraview.simple import FindSource
  t = self.GetAnimationTime()
  cal = FindSource('Calculator1') # XXX: update to match the name of your Calculator filter
  cal.Function = f'DISPL_X*{t}' # XXX: adjust function as appropriate

def end_cue(self): pass

```

---

<div class="post-metadata">

### Author: ![reox](https://discourse.paraview.org/user_avatar/discourse.paraview.org/reox/32/16237_2.png) [@reox](https://discourse.paraview.org/u/reox)
#### Post date: [March 9, 2023, 7:19am UTC](https://discourse.paraview.org/t/scale-scalar-value-in-animation/11540/6 "2023-03-09T07:19:06Z")

</div>

ahhh I see! Thank you so much, that works perfectly!
