fiber+react实现直线弯曲动画效果代码
代码语言:html
所属分类:动画
代码描述:fiber+react实现直线弯曲动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" /> <style> body { margin: 0; height: 100vh; overflow: hidden; background: #000; } </style> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/babel.7.18.13.js"></script> </head> <body> <script type="text/babel" data-type="module"> import React, { useRef, useMemo } from 'https://cdn.skypack.dev/react@17.0.2' import ReactDOM from 'https://cdn.skypack.dev/react-dom@17.0.2' import { Canvas, useFrame, useThree } from 'https://cdn.skypack.dev/@react-three/fiber@7.0.24' const lerp = (a, b, n) => (1 - n) * a + n * b const Plane = () => { const $mesh = useRef() const { viewport } = useThree() useFrame(({ clock }) => { $mesh.current.material.uniforms.T.value = clock.getElapsedTime() }) const args = useMemo(() => ({ uniforms: { T: { value: 0 }, R: { value: viewport.hei.........完整代码请登录后点击上方下载按钮下载查看
网友评论0