There is some delay from time to time, I guess this is
related to the GC ?
Yes, this script is probably the most inefficient way to implement this. On my machine,
there is a pause every 9 seconds approx.
Consider this slightly modified script:
| v anim |
v := RTView new.
shape := RTBox new color: [ :o | Color random ]; size: 25.
anim := RTActiveAnimation new.
anim intervalInMilliseconds: 100.
anim blockToExecute: [
|e|
v clean.
(1 to: 400) do:[:i|
e := shape element.
v add: e].
RTGridLayout new
gapSize:0;
lineItemsCount: 20;
on:v elements.
].
anim inView: v.
^ v
Shape are reused and not created each time. Again on my machine, the pause occurs after
~15 seconds.
Removing, creating and adding elements at each refresh is not efficient at all. You can
simply update the property of the element by either sending #updateShape or directly
modifying the trachel shape.
In that case, you need a model and the element reflect the property of the model. There is
no need to recreate elements all the time.
Cheers,
Alexandre