Professional Documents
Culture Documents
document.addEventListener("onLoad", onGoalLoad);
document.addEventListener("onEventReceived", onGoalEvent);
gsap.registerPlugin(SplitText);
if (defStrokeId.length) {
defIds = defStrokeId;
}
if (defIds.length) {
const def = defIds[1];
const svgDefinition = document.getElementById(def);
svgDefinition.innerHTML = gradient.join('');
colors.forEach(function(color, index) {
let stopColor = color.color;
let stopOpacity = color.hasOwnProperty('opacity') ? color.opacity : 1;
svgDefinition.children[index].setAttribute('style', `stop-color: $
{stopColor}`);
svgDefinition.children[index].setAttribute('style', `stop-opacity: $
{stopOpacity}`);
});
}
}
}
const proxy = {
frame: goalTimeline.firstFrame
};
function hideAmount() {
const hide = gsap.timeline({});
var mainImg = document.getElementById('mainImg');
hide.to("#goal-current", {duration: 1, opacity: 0})
hide.fromTo("#mainImg", {duration: 2, scale: 1}, {ease: "power4.inOut",
scale: 0})
hide.to("#mainImg", {ease: "power4.inOut", scale: 1})
hide.add( function(){mainImg.src=fieldData.image1.value;}, "-=.5")
currentAmount = 0;
}
gsap.set("#goal-widget", {
opacity: 1
});
function onGoalEvent(e) {
let event = e.detail;
var str = event.tag;
var giftedevent = str.includes("gifted