Hii! I am really new in this coding space: However working on my website I copied at pasted two codes
Both of them start with
import wixAnimations from ‘wix-animations’;
and Is causing my code to fail because the identifier has been already declared.
what should I do?
This is how it looks:
import wixAnimations from “wix-animations” ;
import wixWindow from “wix-window” ;
const runningTxt = wixAnimations . timeline ({ repeat : - 1 });
$w . onReady ( function () {
playRunningTxt ();
function playRunningTxt () {
let sliderWidth ;
wixWindow . getBoundingRect ()
. then (( windowSizeInfo ) => {
let windowWidth = windowSizeInfo . window . width ;
if ( windowWidth > 1000 ) {
//Desktop
sliderWidth = 5000 / 3 ;
} **else if** ( windowWidth >= 751 ) {
// Tablet
sliderWidth = 4050 / 3 ;
} **else if** ( windowWidth <= 750 ) {
// Mobile
sliderWidth = 3350 / 3 ;
}
runningTxt
. add ( $w ( "#runningTxt" ), { x : - sliderWidth , duration : 10000 , easing : "easeLinear" }). play ();
});
$w ( "#txtSection" ). onViewportEnter (() => {
runningTxt . play ();
});
$w ( "#txtSection" ). onViewportLeave (() => {
runningTxt . pause ();
});
}
});
import wixAnimations from ‘wix-animations’ ;
const infinity_rotation_timeline = wixAnimations . timeline ({ repeat : - 1 });
$w . onReady ( function () {
initRotationAnimation ();
});
function initRotationAnimation ( ) {
const element_to_rotate = $w ( ‘#Circlefooter’ );
infinity_rotation_timeline . add ( element_to_rotate , { rotate : 360 , duration : 40000 , easing : 'easeLinear' }). play ();
}
// Learn more about wixAnimation:
// wix-animations-frontend - Velo API Reference - Wix.com