@@ -170,11 +170,11 @@ const EasyCoder_VFX = {
170
170
let heightS = height * zoomS ;
171
171
animation . leftS = width * zoomS * spec . start . left / 100 ;
172
172
animation . topS = height * zoomS * spec . start . top / 100 ;
173
- let widthF = width * 100 / spec . finish . width ;
174
- let zoomF = widthF / width ;
173
+ animation . widthF = width * 100 / spec . finish . width ;
174
+ let zoomF = animation . widthF / width ;
175
175
let heightF = height * zoomF ;
176
- let leftF = width * zoomF * spec . finish . left / 100 ;
177
- let topF = height * zoomF * spec . finish . top / 100 ;
176
+ animation . leftF = width * zoomF * spec . finish . left / 100 ;
177
+ animation . topF = height * zoomF * spec . finish . top / 100 ;
178
178
179
179
if ( spec . start . width > 100 ) {
180
180
throw new Error ( `Start width too great for item ${ targetRecord . index } ` ) ;
@@ -188,16 +188,12 @@ const EasyCoder_VFX = {
188
188
if ( heightS - animation . topS < height ) {
189
189
throw new Error ( `Insufficient start height for item ${ targetRecord . index } ` ) ;
190
190
}
191
- if ( widthF - leftF < width ) {
191
+ if ( animation . widthF - animation . leftF < width ) {
192
192
throw new Error ( `Insufficient finish width for item ${ targetRecord . index } ` ) ;
193
193
}
194
- if ( heightF - topF < height ) {
194
+ if ( heightF - animation . topF < height ) {
195
195
throw new Error ( `Insufficient finish height for item ${ targetRecord . index } ` ) ;
196
196
}
197
-
198
- animation . stepL = ( leftF - animation . leftS ) / spec . steps ;
199
- animation . stepT = ( topF - animation . topS ) / spec . steps ;
200
- animation . stepW = ( widthF - animation . widthS ) / spec . steps ;
201
197
animation . left = animation . leftS ;
202
198
animation . top = animation . topS ;
203
199
animation . width = animation . widthS ;
@@ -274,9 +270,10 @@ const EasyCoder_VFX = {
274
270
const animation = targetRecord . animation [ targetRecord . index ] ;
275
271
if ( animation . step < animation . spec . steps ) {
276
272
animation . step ++ ;
277
- animation . left += animation . stepL ;
278
- animation . top += animation . stepT
279
- animation . width += animation . stepW ;
273
+ let proportion = parseFloat ( animation . step ) / animation . spec . steps ;
274
+ animation . left = animation . leftS + ( animation . leftF - animation . leftS ) * proportion ;
275
+ animation . top = animation . topS + ( animation . topF - animation . topS ) * proportion ;
276
+ animation . width = animation . widthS + ( animation . widthF - animation . widthS ) * proportion ;
280
277
const image = animation . image ;
281
278
image . style . left = `-${ animation . left } px` ;
282
279
image . style . top = `-${ animation . top } px` ;
0 commit comments