@Young11

Как пользователь может сам задать длительность анимации?

Не могу понять , как присвоить значение которое ввел пользователь к fadeOut ?
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
   <div id="app" class="wraper">
      <div class="notifacation" id="notifacation">
         <input v-model="value">
            {{ value }}
         <button v-on:click="changeWidth()">Change</button>
         <section class="first-item" v-bind:style="{ fadeOut: computedfadeOut }">
            <img class="first-item__img" src="img/infocircle.png" alt="infocircle">
            <p class="first-item__text">Текстовый текст, что б его! Текстовый текст, что б его! <br>
            Текстовый текст, что б его! Текстовый текст, что б его!</p>
            <div class="first-item__progress"></div>
         </section>
      </div>
   </div>

@import url(nulstyle.scss);
@import url(https://fonts.googleapis.com/css?family=Montserrat:100,200,300,regular,500,600,700,800,900);
.first-item {
	display: flex;
   align-items: center;
   height: 9.556vh;
   width: 38.542vw;
   opacity: 0.7;
   filter: drop-shadow(0px 6px 8px rgba(0, 0, 0, 0.25));
   background: linear-gradient(90.49deg, #007EFF 0.42%, rgba(0, 0, 0, 0.6) 95.58%);
   box-shadow: 0px 4px 32px 3px rgba(0, 0, 0, 0.25);
   backdrop-filter: blur(1.389vh);
   border-radius: 2.389vh;
	overflow: hidden; 
   position: relative; 
}

.first-item__img {
	float: left;
   height: 5.556vh;
   width: 5.556vh; 
   padding: 1.189vh 1.389vh 0 1.389vh;
}

.first-item__text {
   font-family: 'Montserrat';
   font-style: normal;
   font-weight: 400;
   font-size: 2.03704vh;
   line-height: 1.3;
   display: flex;
   align-items: center;
   letter-spacing: -0.05em;
   color: #FFFFFF;
   text-shadow: 0px 0.4px 4px rgba(0, 0, 0, 0.5);
	padding-top: 2.189vh;
	margin-top: 0;
}

.first-item__progress {
	position: absolute;
    bottom: 0px;
    width: 0%;
    border-bottom: 0.512vh solid #FFFFFF;;
}


.first-item {
	-webkit-animation: fadeOut 4.5s linear forwards;
	-moz-animation: fadeOut 4.5s linear forwards;
	-o-animation: fadeOut 4.5s linear forwards;
	-ms-animation: fadeOut 4.5s linear forwards;
	animation: fadeOut 4.5s linear forwards;
}

.first-item .first-item__progress {
	-webkit-animation: runProgress 3.3s linear forwards 0.7s;
	-moz-animation: runProgress 3.3s linear forwards 0.7s;
	-o-animation: runProgress 3.3s linear forwards 0.7s;
	-ms-animation: runProgress 3.3s linear forwards 0.7s;
	animation: runProgress 3.3s linear forwards 0.7s;
}

@-webkit-keyframes fadeOut {
	0% { opacity: 0; }
	10% { opacity: 1; }
	90% { opacity: 1; -webkit-transform: translateY(0px);}
	99% { opacity: 0; -webkit-transform: translateY(-25px);}
	100% { opacity: 0; }
}

@-webkit-keyframes runProgress {
	0%{ width: 0%; }
	100%{ width: 100%; }
}

@-moz-keyframes runProgress {
	0%{ width: 0%; }
	100%{ width: 100%; }
}

@-o-keyframes runProgress {
	0%{ width: 0%; }
	100%{ width: 100%; }
}

@-ms-keyframes runProgress {
	0%{ width: 0%; }
	100%{ width: 100%; }
}

@keyframes runProgress {
	0%{ width: 0%; }
	100%{ width: 100%; }
}


new Vue({
   el: '#app',
   data: {
     value: null,
     fadeOut: 0
   },
   computed: {
      computedfadeOut: function () {
        return this.value;
      }
    },
    methods: {
      changefadeOut: function (event) {
        this.value= fadeOut;
      }
    }
 });
  • Вопрос задан
  • 150 просмотров
Пригласить эксперта
Ответы на вопрос 1
Geminix
@Geminix
Фуллстек nuxt, .net разработчик
Может computed свойство должно возвращать fadeOut, а в методе changefadeOut наоборот this. fadeOut = value?
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы