1 回答
TA贡献1817条经验 获得超14个赞
希望这可以帮助任何人。
...
var that = this,
returnLetterTransform = () => {
const y = Math.random() * (15 - 6) + 6;
return 'translate3d(0,' + -y + 'vh,0)'
},
/* change to function
to get object dynamically
*/
letter = () => {
const transform = that.state.foldedLogo ? that.returnLetterTransform() : 'translate3d(0,0,0)';
return { transform: transform };
};
render() {
return(
/* call dynamic letter function */
... style={that.letter()} ...
... style={that.letter()} ...
...
);
}
添加回答
举报
