gemats
January 20, 2021, 8:47am
1
Hi,
I’m trying to follow this Timeline Code Example:
import wixAnimations from 'wix-animations';
let timeline = wixAnimations.timeline();
// ...
const myImage1 = $w("#myImage1");
=============>>> const someImages = $w("#myImage2", "#myImage3"); <<<===========
const vectorImages = $w("VectorImage");
0
//Adds an animation for myImage1
timeline.add(myImage1, {
"rotate": 360,
"scale": .5,
"duration": 1000
})
as found here. I get an error though in my Code Editor that “$w should get only one argument”.
Any ideas?
gemats
January 20, 2021, 8:53am
2
Solved it by bypassing the problematic syntax and using square brackets, like this:
let timelineInit = wixAnimations.timeline({"repeat": -1});
const myImageInit = $w("#vectorImage118");
const myImageInit2 = $w("#vectorImage119");
timelineInit
.add( [myImageInit,myImageInit2], { <<==============
"rotate": 360 * 100,
"duration": 20000 * 100,
"easing": 'easeOutQuint'
} )
But the syntax in the API reference most probably should be corrected, in this specific example. It’s the Code Example snippet entitled “Add animations on multiple page elements together”.