reactjs - 未在生产中加载 GSAP 动画
问题描述
使用 Green sock 动画的 gatsby 插件制作的非常简单的 GSAP 动画,通过 react 加载一个 iframe 并使其淡入淡出。
当我在我的 firebase 应用程序上部署时,动画不再起作用。
当动画在本地完成时完美运行时,有什么可能的原因会阻止动画在部署时运行?
控制台中没有报告任何问题。而且我不知道如何在反应中正确使用事件断点。
import React, { Component } from "react";
import { TimelineLite, CSSPlugin } from "gsap/all";
import Iframe from 'react-iframe';
import F from "../land.module.scss";
import Button from "components/CustomButtons/Button.jsx";
thing component extension etc {
constructor(props){
super(props);
// container
this.commentContainer = null;
// tween
this.Comments = null;
}
componentDidMount(){
// create tween
this.Comments = new TimelineLite({ paused:true })
// .to(this.commentContainer, 2, { x: 300 })
// .to(this.commentContainer, 1, { rotation: 360, transformOrigin: "center" })
.fromTo(this.commentContainer, {opacity: 0}, {opacity: 1, duration: 1});
}
render()
return
<>
<button onClick={() => this.Comments.play()}>just the button</button>
<div className={`${F.fb} col-12 mt-3`} ref={ this_ => this.commentContainer = this_ }>
<Iframe> ---- the iframe details etc URL, position, width height styles.
export defaults.
该代码可能无助于停滞,因为它在使用 gatsby develop 时在各个方面都能正常工作。
解决方案
推荐阅读
- http-post - Retrotif2 + RxJava 发送 POST 请求失败
- r - 通过 R 中的操作列选择具有零值的组
- tsql - 聚合在 T-SQL 中给出错误的结果
- bash - shell脚本中目录中的文件列表
- coq - 如何在 Coq 中进行高阶项重写?
- python - 有什么方法可以停止使用 HTTP 标头在 CGI python 中下载文件:Content-disposition?
- python - 点子升级不会删除旧点子和中断
- laravel - 如何在 Laravel、Redis、SocketIO 中高效展示用户在线状态
- marklogic - Expanded tree cache full 报错需要调优查询
- asp.net - ASP.NET AJAX.BeginForm 发送请求两次并添加重复条目