css动画渐变及动态宽度设置-vue demo制作

css动画渐变及动态宽度设置

<template>
  <div id="userLayout" :class="['user-layout-wrapper']">
    <div class="container">
      <div style="width:1300px;height:200px;margin:0 auto;background:#f0f0f0;">
        <div :class="changeID===2?'rowRecord':'rowRecord1'">
          <div :class="[item.id===changeID?'itemReocrd':'itemReocrd1']"
           @click="selectId(item)"
          v-for="item in content" :key="item.id">
          <div class="contss" v-if="item.id===changeID">

          </div>
        </div>
        </div>
        
    </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'UserLayout',
  data(){
    return {
      content:[{
        id:1,
      },{
        id:2,
      },{
        id:3,
      },{
        id:4,
      },{
        id:5,
      },{
        id:6,
      },],
      changeID:0,
      
    }
  },
  methods: {
    selectId(item){
      this.changeID=item.id
    },
   
  }
}
</script>

<style lang="less" scoped>
.contss{
  width:140px;
  height:200px;
  background:#1890ff;
  border-radius:10px;
  margin-right:20px;
  animation: 2.5s opacity2;
  animation-fill-mode:forwards;
}
  @keyframes opacity2{
    from {width:140px;margin:0 auto;}
to {width:330px;margin:0 auto;}
      0%{opacity:0}
      25%{opacity:.25;}
      50%{opacity:.5;}
      75%{opacity:.8;}
      100%{opacity:1;}
  }
.rowRecord1{
  width:900px;
  height:200px;
  margin:0 auto;
}
.rowRecord{
  width:900px;
  height:200px;
  margin:0 auto;
  animation:mymoves 1s;
animation-fill-mode:forwards;
}

@keyframes mymoves
{
from {width:900px;margin:0 auto;}
to {width:1100px;margin:0 auto;}
}

.itemReocrd1{
  width:140px;
  height:200px;
  margin-right:10px;
  background: #aaa;
  border:1px solid #f00;
  border-radius:10px;
  float:left;
}
.itemReocrd{
  width:140px;
  height:200px;
  border-radius:10px;
  margin-right:10px;
  float:left;
animation:mymove 2s;
animation-fill-mode:forwards;
}

@keyframes mymove
{
from {width:150px;margin:0 auto;}
to {width:350px;margin:0 auto;}
}

</style>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Shero.李建业

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值