function prepareAnimationWhenNoOld(lasts, element, storageName) {
        var lastCfg = lasts[thisRawIndex] = {};
        var parentNode = thisNode.parentNode;

        if (parentNode && (!reRoot || reRoot.direction === 'drillDown')) {
            var parentOldX = 0;
            var parentOldY = 0;

            // New nodes appear from right-bottom corner in 'zoomToNode' animation.
            // For convenience, get old bounding rect from background.
            var parentOldBg = lastsForAnimation.background[parentNode.getRawIndex()];
            if (!reRoot && parentOldBg && parentOldBg.old) {
                parentOldX = parentOldBg.old.width;
                parentOldY = parentOldBg.old.height;
            }

            // When no parent old shape found, its parent is new too,
            // so we can just use {x:0, y:0}.
            lastCfg.old = storageName === 'nodeGroup'
                ? [0, parentOldY]
                : {x: parentOldX, y: parentOldY, width: 0, height: 0};
        }

        // Fade in, user can be aware that these nodes are new.
        lastCfg.fadein = storageName !== 'nodeGroup';
    }
function prepareAnimationWhenNoOld(lasts, element, storageName) {
        var lastCfg = lasts[thisRawIndex] = {};
        var parentNode = thisNode.parentNode;

        if (parentNode && (!reRoot || reRoot.direction === 'drillDown')) {
            var parentOldX = 0;
            var parentOldY = 0;

            // New nodes appear from right-bottom corner in 'zoomToNode' animation.
            // For convenience, get old bounding rect from background.
            var parentOldBg = lastsForAnimation.background[parentNode.getRawIndex()];
            if (!reRoot && parentOldBg && parentOldBg.old) {
                parentOldX = parentOldBg.old.width;
                parentOldY = parentOldBg.old.height;
            }

            // When no parent old shape found, its parent is new too,
            // so we can just use {x:0, y:0}.
            lastCfg.old = storageName === 'nodeGroup'
                ? [0, parentOldY]
                : {x: parentOldX, y: parentOldY, width: 0, height: 0};
        }

        // Fade in, user can be aware that these nodes are new.
        lastCfg.fadein = storageName !== 'nodeGroup';
    }
function prepareAnimationWhenNoOld ( lasts , element , storageName ) { var lastCfg = lasts [ thisRawIndex ] = { } ; var parentNode = thisNode . parentNode ; if ( parentNode && ( ! reRoot || reRoot . direction === 'drillDown' ) ) { var parentOldX = 0 ; var parentOldY = 0 ; // New nodes appear from right-bottom corner in 'zoomToNode' animation. // For convenience, get old bounding rect from background. var parentOldBg = lastsForAnimation . background [ parentNode . getRawIndex ( ) ] ; if ( ! reRoot && parentOldBg && parentOldBg . old ) { parentOldX = parentOldBg . old . width ; parentOldY = parentOldBg . old . height ; } // When no parent old shape found, its parent is new too, // so we can just use {x:0, y:0}. lastCfg . old = storageName === 'nodeGroup' ? [ 0 , parentOldY ] : { x : parentOldX , y : parentOldY , width : 0 , height : 0 } ; } // Fade in, user can be aware that these nodes are new. lastCfg . fadein = storageName !== 'nodeGroup' ; }
If a element is new, we need to find the animation start point carefully, otherwise it will looks strange when 'zoomToNode'.
If a element is new we need to find the animation start point carefully otherwise it will looks strange when zoomToNode .
Prepare animation when no old shape found