MCPcopy Index your code
hub / github.com/SortableJS/Sortable / animate

Function animate

src/Animation.js:132–161  ·  view source on GitHub ↗
(target, currentRect, toRect, duration)

Source from the content-addressed store, hash-verified

130 },
131
132 animate(target, currentRect, toRect, duration) {
133 if (duration) {
134 css(target, 'transition', '');
135 css(target, 'transform', '');
136 let elMatrix = matrix(this.el),
137 scaleX = elMatrix && elMatrix.a,
138 scaleY = elMatrix && elMatrix.d,
139 translateX = (currentRect.left - toRect.left) / (scaleX || 1),
140 translateY = (currentRect.top - toRect.top) / (scaleY || 1);
141
142 target.animatingX = !!translateX;
143 target.animatingY = !!translateY;
144
145 css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
146
147 this.forRepaintDummy = repaint(target); // repaint
148
149 css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
150 css(target, 'transform', 'translate3d(0,0,0)');
151 (typeof target.animated === 'number') && clearTimeout(target.animated);
152 target.animated = setTimeout(function () {
153 css(target, 'transition', '');
154 css(target, 'transform', '');
155 target.animated = false;
156
157 target.animatingX = false;
158 target.animatingY = false;
159 }, duration);
160 }
161 }
162 };
163}
164

Callers

nothing calls this directly

Calls 3

cssFunction · 0.90
matrixFunction · 0.90
repaintFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…