//So, my rambling begins
I need to know how long it takes before something happens on the animation pipeline.
This listens to screen size dimensions changing.
//Code but do note that you do need to start it and add an element named and hide it.
import wixWindow from ‘wix-window’ ;
let windowHeight = 0 ;
let windowWidth = 0 ;
let windowHeightOld = 0 ;
let windowWidthOld = 0 ;
let delay = 50 ;
let active = true ;
let ticker = wixAnimations . timeline ({
“repeat” : 0 ,
“repeatDelay” : 0 ,
“yoyo” : false });
function preCalculate ( callback ) {
wixWindow . getBoundingRect (). then (( windowSizeInfo ) => {
windowHeight = windowSizeInfo . window . height ;
windowWidth = windowSizeInfo . window . width ;
callback ();
})
;}
function onTick ( ){
if ( active === true ){
preCalculate (()=>{
if (( windowWidthOld != windowWidth )||( windowHeightOld != windowHeight )){
//Do something
}
windowWidthOld = windowWidth ;
windowHeightOld = windowHeight ;
});
ticker . add ( $w ( ‘#dummy’ ), { x : “+=1” , easing : ‘easeLinear’ , duration : delay }). play (). onComplete (()=>{
onTick ();
});
}}
//To enlighten you
I ask because I run into a couple problems and such because my html5 iframe that did this no longer works because of silly changes the browser makers keep making.
Problem is how long it takes before something animates varies per operating system and therefore, timers are not always that useful.
So, I want to use something like this but before I start coding away and it is not allowed, I need to know.
Thus, me asking.
//Question²
import wixAnimations from ‘wix-animations’ ;
let animation = wixAnimations . timeline ({
“repeat” : 0 ,
“repeatDelay” : 0 ,
“yoyo” : false });
function doItDammit ( ){
for ( let i = 0 ; i < 10 ; i ++){
animation . add ( $w ( ‘#movingThingy’ ),{ x : i * 100 , duration : 100 }, 100 )
if ( i === 10 ){
animation . play ();
}}
}
When I update animations at run time there can be a delay.
So, I would like to create them before they play using variables, I get; like screen width and such but, in the background, then when done play them.
However, when I do this, I believe only the first or last one is added.
It doesn’t really make sense that this does not work.
Rather annoying but, is this me or is this them?