Hi guys!
I didn't want to start another topic, so I take advantage of this one!
I don't understand how to use data-attributes and ScrollTrigger together.
<div class="box-wrapper">
<div class="box" data-from='{"yPercent": "0", "rotation": "60"}'></div>
<div class="box" data-from='{"yPercent": "90", "rotation": "20"}'></div>
<div class="box" data-from='{"yPercent": "40", "rotation": "10"}'></div>
<div class="box" data-from='{"yPercent": "5", "rotation": "0"}'></div>
<div class="box" data-from='{"yPercent": "10", "rotation": "20"}'></div>
</div>
gsap.utils.toArray('.box').forEach((elem, i) => {
let from = JSON.parse(elem.dataset.from);
gsap.from(elem, {
from,
scrollTrigger: {
trigger: ".box-wrapper",
start: "top bottom",
end:"bottom center",
scrub:true,
markers:true
}
});
})
Invalid property from set to Objectrotation: "20"yPercent: "10"__proto__: Object Missing plugin? gsap.registerPlugin()
Here's the codepen link: https://codepen.io/teddybrown/pen/OJMdxZY
I know it's a dumb question but please give me some hint!
Thank you!!!