• css 动画 过渡


    1,过渡

    在使用css写相关效果的时候,我们将元素的一种动画效果切换到另一种动画效果,这个时候我们需要规定两点,1,给元素的哪些属性添加动画效果,2,规定动画效果的时长

    2,过渡的属性

    transition-property

    过渡的属性值

    过渡的属性值没有限制,

    带px的 (字体大小,宽高等),

    不带px的 (背景色,字体颜色)

    transition-duration

    过渡的时间

    设置的值越小,动画越快

    当值为0时没有过渡动画效果

    transition-timing-function

    å¨è¿éæå¥å¾çæè¿°

     transition-delay

    动画的延时时间,经过多久之后开始动画

    示例

    1. <template>
    2. <view class=''>
    3. <view class="test1" :class="{
    4. testMove:moveRight
    5. }">
    6. view>
    7. <button @click="move">移动button>
    8. view>
    9. template>
    10. <script>
    11. export default {
    12. components: {},
    13. data: () => ({
    14. moveRight: false
    15. }),
    16. computed: {},
    17. watch: {},
    18. onLoad(options) {
    19. },
    20. onShow() {
    21. },
    22. onReady() {
    23. },
    24. methods: {
    25. move() {
    26. this.moveRight=true
    27. }
    28. },
    29. onHide() {},
    30. onUnload() {},
    31. onPullDownRefresh() {
    32. uni.stopPullDownRefresh();
    33. },
    34. onReachBottom() {}
    35. }
    36. script>
    37. <style lang='scss'>
    38. .test1 {
    39. width: 200rpx;
    40. height: 120rpx;
    41. background-color: #f00;
    42. transition-property: all;
    43. font-size: 24rpx;
    44. transition-duration: 1000ms;
    45. transition-timing-function: ease-in;
    46. transition-delay: 1000ms;
    47. color: #fff;
    48. text-align: left;
    49. }
    50. .testMove{
    51. margin-left:600rpx;
    52. background-color: green;
    53. font-size: 80rpx;
    54. color: #000;
    55. text-align: right;
    56. }
    57. style>

  • 相关阅读:
    C语言 牛客网习题 10.20 day2
    字节跳动测开实习生面试,拿15K过分吗?
    海外社媒营销新策略:故事化叙事如何触动用户情感,增强品牌魅力
    【暴力DP】CF1409 F
    Docker中将静态页面部署nginx
    【微服务】- 服务调用 - OpenFeign
    树上查询SPOJQTREE4
    HAL_UART_Receive不能正常超时返回
    redis的事务
    java线程池介绍
  • 原文地址:https://blog.csdn.net/qq_42389674/article/details/126332628