簡體   English   中英

無法使用 react-spring 為 html 進度設置動畫

[英]Can't animate html progress using react-spring

我正在嘗試使用 react-spring 像這樣為 html 條形元素設置動畫:

import { useSpring, animated } from 'react-spring'

const Example = ()=> {
    const props = useSpring({ value: 320, from: { value: 0 } });

    return (
    <animated.div>
       <progress style={{width:"70%"}} id="file" value={props.value}  max="1000"/>
    <animated.div/>
   )
}

它根本行不通

這是 html 進度條的限制還是我有什么問題?

我對 CodeSanbox 進行了一些編輯以顯示它(不)工作: https://codesandbox.io/s/react-spring-usespring-hook-forked-d5sez?file=/src/index.js

謝謝

嘗試使用進度的動畫版本。 並使用道具的價值。

<div>
  <animated.progress id="file" value={props.value} max="1000" />
</div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM