
Documentation
adlissmart
Code
Setup: External Scripts
External Scripts in adlissmart
Make sure to always put the External Scripts before the Javascript step of the resource.
In this video you learn where to put these in your adlissmart project? Or how to include a paid GSAP Club plugin in your project?
HTML
<script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/gsap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/MorphSVGPlugin.min.js"></script>Step 1: Copy structure to adlissmart
Copy structure to adlissmart
In the video below we described how you can copy + paste the structure of this resource to your adlissmart project.
Copy to adlissmart
adlissmart structure is not required for this resource.
Step 1: Add HTML
HTML
<button data-play-pause="toggle" class="play-pause-button">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" viewbox="0 0 24 25" fill="none" class="play-pause-icon">
<path d="M3.5 5L3.50049 3.9468C3.50049 3.177 4.33382 2.69588 5.00049 3.08078L20.0005 11.741C20.6672 12.1259 20.6672 13.0882 20.0005 13.4731L17.2388 15.1412L17.0055 15.2759M3.50049 8L3.50049 21.2673C3.50049 22.0371 4.33382 22.5182 5.00049 22.1333L14.1192 16.9423L14.4074 16.7759" stroke="currentColor" stroke-width="1.5" stroke-miterlimit="16" stroke-linecap="round" data-play-pause="path"></path>
</svg>
</button>HTML structure is not required for this resource.
Step 2: Add CSS
CSS
.play-pause-button {
background-color: #000;
border: none;
justify-content: center;
align-items: center;
width: max(7.5rem, 10vw);
height: max(7.5rem, 10vw);
padding: 0;
display: flex;
}
.play-pause-icon {
width: 100%;
height: 100%;
}Step 2: Add custom Javascript
Custom Javascript in adlissmart
In this video, Ilja gives you some guidance about using JavaScript in adlissmart:
Step 2: Add Javascript
Step 3: Add Javascript
Javascript
gsap.registerPlugin(MorphSVGPlugin);
function initMorphingPlayPauseToggle() {
const playPath = "M3.5 5L3.50049 3.9468C3.50049 3.177 4.33382 2.69588 5.00049 3.08078L20.0005 11.741C20.6672 12.1259 20.6672 13.0882 20.0005 13.4731L17.2388 15.1412L17.0055 15.2759M3.50049 8L3.50049 21.2673C3.50049 22.0371 4.33382 22.5182 5.00049 22.1333L14.1192 16.9423L14.4074 16.7759";
const pausePath = "M15.5004 4.05859V5.0638V5.58691V8.58691V15.5869V19.5869V21.2549M8.5 3.96094V10.3721V17V19L8.5 21";
const buttonToggle = document.querySelector('[data-play-pause="toggle"]');
const iconPath = buttonToggle.querySelector('[data-play-pause="path"]');
let isPlaying = false; // keep track of state to control the morph
buttonToggle.addEventListener("click", () => {
gsap.to(iconPath, {
duration: 0.5,
morphSVG: {
type: "rotational",
map: "complexity", // morphs the shape based on the amount of anchor points, it's fastest!
shape: isPlaying ? playPath : pausePath, // if button is 'playing', morph to pause and vice versa
},
ease: "power4.inOut",
});
isPlaying = !isPlaying; // control play/pause state again
});
}
// Initialize Morphing Play/Pause Toggle
document.addEventListener('DOMContentLoaded', () => {
initMorphingPlayPauseToggle();
});Step 3: Add custom CSS
Step 2: Add custom CSS
Custom CSS in adlissmart
Curious about where to put custom CSS in adlissmart? Ilja explains it in the below video:
CSS
















































































