TimeLineMax() class 即使包含 cdn 链接也无法解析
TimeLineMax() class doesn't resolve even with including the cdn links
我正在使用 PHPstorm,我在关闭标签之前放置了 CDN 链接:
const timeLine = new TimeLineMax();
timeLine.from(
...
);
HTML code ...
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.1.1/gsap.min.js" type="text/javascript" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TimelineMax.min.js"></script>
<script src="js/main-2.js" type="text/javascript" defer></script>
</body>
</html>
我还下载了 PHPstorm 中的 gsap 库:
screenshot of my editor
但是 PHPstorm 仍然没有解析我的 JS 文件中的 TimeLineMax() class。
是TimelineMax,不是TimeLineMax。此外,如果您正在加载 GSAP 3(就像您一样),您 could/should 将使用 GSAP 3 的新 API 格式:
const timeLine = gsap.timeline();
timeLine.from(target, {
duration: 1,
...
});
您也不需要加载 TimelineMax 文件,它包含在您包含的 GSAP 核心文件中。你正在做的是混合版本,这是行不通的。
我正在使用 PHPstorm,我在关闭标签之前放置了 CDN 链接:
const timeLine = new TimeLineMax();
timeLine.from(
...
);
HTML code ...
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.1.1/gsap.min.js" type="text/javascript" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TimelineMax.min.js"></script>
<script src="js/main-2.js" type="text/javascript" defer></script>
</body>
</html>
我还下载了 PHPstorm 中的 gsap 库: screenshot of my editor
但是 PHPstorm 仍然没有解析我的 JS 文件中的 TimeLineMax() class。
是TimelineMax,不是TimeLineMax。此外,如果您正在加载 GSAP 3(就像您一样),您 could/should 将使用 GSAP 3 的新 API 格式:
const timeLine = gsap.timeline();
timeLine.from(target, {
duration: 1,
...
});
您也不需要加载 TimelineMax 文件,它包含在您包含的 GSAP 核心文件中。你正在做的是混合版本,这是行不通的。