As the title said, maybe you can add a function called
instanceName()
, it will only work in a component. And return the instance layer name of this component in runtime.
Here is a use case for this function:
Assume we have a component named
cell
, and several instance layer of this component in one scene, named
cell 1
,
cell 2
, ...
All of this cells are out of screen at the beginnning, maybe right side of the screen. We need to move them into the screen one by one. Each of the move animation have a short interval. A very sample interaction, but still need a lot of work for now.
So, if we have the
instanceName()
function, it will be more easier.
  1. create a number type variable in the component, name
    index
    .
  2. check
    Use Formula
    for variable
    index
    , the formula will like this:
    number(right(instanceName(),length(instanceName())-indexOf(instanceName()," ")-1))
  3. instanceName()
    will return the name of current instance, for layer
    cell 1
    it will be "cell 1";
  4. so,
    length(instanceName())
    will get 6,
    indexOf(instanceName()," ")
    will get 4, minus with 1 will get the instance index.
  5. with
    start
    trigger, just add a
    move
    response to move the component to x:0, and set the delay to
    0.5*index
    or
    0.5*(index-1)
  6. add an instance of this component to the scene, copy & paste, with ProtoPie 5.5, all the instance will get a auto-increase index start from 1.
  7. all we need to do is to put all the layers to screen right, then adjust the y position for every layer.
  8. run the prototype, everything will be done automatically.
One more thing, if we have
instanceName()
the
layer()
function will also be more powerful.