Skip to content

Instantly share code, notes, and snippets.

@thisisjamessmith
Created September 20, 2018 17:07
Show Gist options
  • Save thisisjamessmith/2362756c5e21035a262cc4305ced68a6 to your computer and use it in GitHub Desktop.
Save thisisjamessmith/2362756c5e21035a262cc4305ced68a6 to your computer and use it in GitHub Desktop.
// This alternative version creates the delays based on an easing curve.
// Nice, but needs some tweaking. See here: http://sol.gfxile.net/interpolation/
$('.js-transitionDelays').each(function(){
var items = $(this).find('> li > a');
var total = items.length;
items.each(function(i) {
var multiplier = i/total;
var speedFactor = 0.39;
var j = .22; // starting base value
var k = speedFactor *(Math.sin(multiplier * Math.PI/2));
var string = j + k + 's';
$(this).css({'transition-delay':string});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment