Im trying to get this animated polygon background from codepen working within a svelte component.
https://codepen.io/NyX/pen/bEbKZz
$(function () {
const $polygons = $('.bg > polygon');
const ANIM = {
duration: 0.6,
stagger: 0.005,
from: {
opacity: 0,
scale: 0,
transformOrigin: 'center center',
force3D: true },
to: {
opacity: 1,
scale: 1,
ease: Elastic.easeInOut,
force3D: true } };
const timeline = new TimelineMax({
delay: 0,
repeat: 0
//repeatDelay: 0.5,
//yoyo: true
});
timeline.staggerFromTo($polygons, ANIM.duration, ANIM.from, ANIM.to, ANIM.stagger, 0);
//TweenMax.staggerFromTo(polygons, ANIM.duration, ANIM.from, ANIM.to, ANIM.stagger);
$('body').addClass('loaded');
});
I've tried a number of things but I cant seem to get it working, I tried making a svelte repl to show my progress but that isnt working either.
I think the source of the issue is not knowing how to handle the $ within the script tags of the svelte component.