gpt4 book ai didi

animation - 我如何在 Elm-UI 中的鼠标悬停动画?

转载 作者:行者123 更新时间:2023-12-04 03:30:20 24 4
gpt4 key购买 nike

将鼠标悬停在按钮上时,我想要一个简单的删除。我想出使用 mouseOver 来更改悬停时的背景,但我不确定如何创建从一个背景到另一个背景的删除。
我知道 elm-simple-animation ,但我对 Elm 太陌生,无法理解文档。
谢谢!

最佳答案

这是令人惊讶的,部分原因是我怀疑专门围绕 elm-ui 设计的适当转换库(AFAICT)仍然缺失。
基本步骤是这样的:

  • 定义开始和鼠标悬停状态的属性。
  • 找出这些属性对应于 elm-simple-animation 中的哪些属性。
  • 为这些添加过渡。
  • Element.Input.button
    [ Background.color (Element.rgb 0.5 0.5 0.6)
    , Element.mouseOver
    [ Background.color (Element.rgb 0.7 0.7 1)
    ]
    , Transition.properties
    [ Transition.backgroundColor 500 []
    ]
    |> Element.htmlAttribute
    ]
    { onPress = Nothing
    , label = Element.text "Hello"
    }

    您可以看到一个工作示例 here

    关于animation - 我如何在 Elm-UI 中的鼠标悬停动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67011204/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com