anima
anima copied to clipboard
Access node specific properties during grid/group animations
It would be nice to be able to access specific properties of the current iterating node while performing a group or grid animation.
For example:
anima.then({
grid = $VBoxContainer,
grid_size = Vector2(3, 3),
animation_type = Anima.GRID.FROM_CENTER,
property = "modulate",
to = Color.red,
duration = 0.3
})
anima.then({
grid = $VBoxContainer,
grid_size = Vector2(3, 3),
animation_type = Anima.GRID.FROM_CENTER,
property = "modulate",
from = Color.red,
to = "myCell:modulate",
iteratee = "myCell"
duration = 0.3
})
The iteratee field could contain the cell that is being animated and by using "
This is just a thought I had, of course it doesn't have to be implemented that specific way if at all. :)
What do you think about making the "to" parameter optional? For example:
anima.then({
grid = $VBoxContainer,
grid_size = Vector2(3, 3),
animation_type = Anima.GRID.FROM_CENTER,
property = "modulate",
from = Color.red,
duration = 0.3
})
each cell animated will animate from red to their colour before the animation started.
In addition I could also implement something like this:
anima.then({
grid = $VBoxContainer,
grid_size = Vector2(3, 3),
animation_type = Anima.GRID.FROM_CENTER,
property = "modulate",
from = Color.red,
to = ":my_custom_value",
duration = 0.3
})
where my_custom_value
is a property of the node. This would allow having a "dynamic" to (and from) value not linked to the "property" animated and will also work for animating a single node, not only grids.
This would be amazing! It can add an incredible amount of versatility
@johnnyneverwalked I just pushed a WIP version of the addon that address the request in this issue:
- Both from and to are optional, if not specified the current node value will be used instead
- A dynamic value can be passed to both from and to parameters, for example:
var anima: AnimaNode = Anima.begin(self)
anima.then({ node = $Node, to = ":size:x", duration = 0.3 })
:size:x
is going to be replaced with the component width value.
You can also pass a formula, for example: - :size:x + :size:y * 50
, or access to any property of the node.
You can also retrieve a parameter from another node, for example:
var anima: AnimaNode = Anima.begin(self)
anima.then({ node = $Node, to = "./AnotherNode:size:x", duration = 0.3 })
Here the initial documentation of how "Dynamic values" work:
https://anima.ceceppa.me/docs/docs/tutorial-extras/dynamic-value/