Conditional ending
From SpinetiX Support Wiki
Introduction
Conditional ending refers to controlling / forcing the end-event of the document or a certain element within the document, based on the end-event of another element present within the document. For this, you can either use jSignage functions (.endEvent
, .endsWith
) or the endsync
SVG attribute.
.endEvent function
The handler included by the .endEvent()
function is called when the layer ends (note that it must not repeat indefinitely, otherwise it will not end). Within this handler function you can:
- End another layer:
$('#my_media').endEvent( function(){
$('#my_animation').end(); // end my_animation layer
});
- Or end the entire document:
$('#my_media').endEvent( function(){
$('svg').attr('dur', $.getCurrentTime() || 0.001 ); // end the document
});
.endsWith function
The .endsWith()
function allows for ending a layer (e.g., an indefinite parent layer) when another layer (e.g., a certain child layer) is ending. For example:
- A group can be ended when the inner video child has ended, thus allowing to apply an out-effect -> see "Controlling the group ending" section.
- Switch to the next slide of a slideshow after finishing scrolling the text content -> see "Display an RSS feed" section.
endsync attribute
The endsync attribute is the SVG alternative to the jSignage solutions above.
For instance, you can end a document when an inner video layer ends, by specifying the endsync
attribute under the svg
element:
<svg [...] dur="unresolved" endsync="my_media" [...] >