Skip to main content

Incident cloning

All Incidents (including Groups and Clips) can create a clone of themselves via the method “clone” which returns a clone of the Incident.

clone method accepts (optionally) two arguments: attrs and props. If provided the attrs and props will either overwrite the original values of the original Incident or add the keys if not present.

For example:

const myIncident = new CSSEffect({
animatedAttrs: {
left: '200px',
top: '50px'
duration: 1000,
selector: '.a'

const myIncident_clone = myIncident.clone({
‘animatedAttrs.width’: '300px',
‘animatedAttrs.background’: 'red'
}, {
duration: 500,
delay: 200

Will produce a new Incident of the same class (CSSEffect) only with the following attributes:

width: ‘300px’, // changed
top: ‘50px’, // copied
background: ‘red’ // added

and the following properties:

selector: '.a', // copied
duration: 500, // changed
delay: 200 // added