lib/packages/core-classes.js
function(template, previous_template, index, current_templates) {

		var animation = this._animations_by_template_guid[template.guid];

		if (Lava.schema.DEBUG && animation && !template.isInDOM()) Lava.t();

		if (template.isInDOM()) {

			// first template does not require moving
			previous_template && this._moveTemplate(template, previous_template, current_templates);

		} else {

			if (previous_template) {

				this._insertTemplate(template, previous_template, index);

			} else {

				this._insertFirstTemplate(template);

			}

			animation = this._createAnimation(template, index);

		}

		if (animation) {

			animation.resetDirection();
			animation.safeStart();

		}

	}
function(template, previous_template, index, current_templates) {

		var animation = this._animations_by_template_guid[template.guid];

		if (Lava.schema.DEBUG && animation && !template.isInDOM()) Lava.t();

		if (template.isInDOM()) {

			// first template does not require moving
			previous_template && this._moveTemplate(template, previous_template, current_templates);

		} else {

			if (previous_template) {

				this._insertTemplate(template, previous_template, index);

			} else {

				this._insertFirstTemplate(template);

			}

			animation = this._createAnimation(template, index);

		}

		if (animation) {

			animation.resetDirection();
			animation.safeStart();

		}

	}
function ( template , previous_template , index , current_templates ) { var animation = this . _animations_by_template_guid [ template . guid ] ; if ( Lava . schema . DEBUG && animation && ! template . isInDOM ( ) ) Lava . t ( ) ; if ( template . isInDOM ( ) ) { // first template does not require moving previous_template && this . _moveTemplate ( template , previous_template , current_templates ) ; } else { if ( previous_template ) { this . _insertTemplate ( template , previous_template , index ) ; } else { this . _insertFirstTemplate ( template ) ; } animation = this . _createAnimation ( template , index ) ; } if ( animation ) { animation . resetDirection ( ) ; animation . safeStart ( ) ; } }
Insert the template into DOM and apply corresponding animation
@param {Lava.system.Template} template
@param {Lava.system.Template} previous_template
@param {number} index Index of this template in list of all active templates
@param {Array.<Lava.system.Template>} current_templates
Insert the template into DOM and apply corresponding animation