var amplitud = 15; // Amplitud del movimiento var frecuencia = 2; // Frecuencia del movimiento (en rebotes por segundo) var duracionBucle = 8; // Duración del bucle en segundos var wiggleX = wiggle(frecuencia, amplitud)[0]; var wiggleY = wiggle(frecuencia, amplitud)[1]; var tiempoTotal = duracionBucle / 2; // Dividimos por 2 porque el bucle completo consta de un ida y vuelta var tiempo = time % tiempoTotal; var posicionInicial = [0, 0]; // Posición inicial del objeto [posicionInicial[0] + wiggleX, posicionInicial[1] + wiggleY]
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter