You can set repeating appearance and disappearance of a required item by setting the auto-blend property.
Auto-blend feature is specified in <auto-blend> node of item XML description:
<cg-item id='text-000'> <text>Sample Text</text> <cg-props scale='text-scale' align='top-left' edges-smooth='3' pos-x='538' pos-y='58' show='yes' move-type='accel-both' alpha='255' bg-color='Black(0)' pixel-ar='0.' play-mode='loop' interlace='auto' width='127' height='27' pause='no'> <indent left='0' right='0' top='0' bottom='0' use-for-bg='no'/> <group-indent left='0' right='0' top='0' bottom='0'/> </cg-props> <auto-blend start='30' ramp='30' on='30' off='60' repeat='yes' rewind='yes'/> </cg-item>
Auto-blend node contains the following attributes:
- start - duration in frames before blending starts
- ramp - time period for transition from On to Off in frames
- on - duration in frames for which the item is shown
- off - duration in frames for which the item is hidden
- repeat - indicates whether the behavior is repeating ('yes') or not ('no')
- rewind - rewinds current state of the item when "auto-blend" is set.
You can specify this behavior via code by using the SetAutoBlend method. This method contains the following parameters:
- _bsItemID - identifier of item
- _pAutoBlend - auto-blend parameters, that are specified with CG_AUTO_BLEND structure.
string myItemID = "myTextItem"; CG_AUTO_BLEND myAutoBlend = new CG_AUTO_BLEND(); // equals to repeat='yes' myAutoBlend.bRepeat = 1; // equals to rewind='yes' myAutoBlend.bRewind = 1; // equals to off='60' myAutoBlend.nMsecOff = 2000; // equals to on='30' myAutoBlend.nMsecOn = 1000; // equals to ramp='30' myAutoBlend.nMsecRamp = 1000; // equals to start='90' myAutoBlend.nMsecStart = 3000; //set the properties m_objCharGen.SetAutoBlend(myItemID, ref myAutoBlend);
Values in structure automatically recalculated to frames according to a frame rate of a source object. In this example, a source is NTSC, that returns 30 frames for 1000 milliseconds.