gpt4 book ai didi

angularjs - Angular 动画不起作用

转载 作者:行者123 更新时间:2023-11-28 06:23:43 25 4
gpt4 key购买 nike

我是 AngularJS 的新手。我无法将动画应用于我的文本和按钮。我在控制台中没有收到任何错误。我不知道哪里出了问题。我想为我的文本和按钮设置不同的动画。我在 html 中提供了 css 动画链接。这是我的 html 页面。请帮助我了解我是否以正确的方式应用动画。

<!doctype html>
<html ng-app="MyApp" >
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="bounceOut.css">
<link rel="stylesheet" href="zoomIn.css">
</head>
<body ng-controller="MyCtrl">
<h3 class="bounceOut">I am</h3> </div>
<button type="submit" class="OptionButton zoomIn">
Submit
</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular-animate.js"></script>
<script>
var app = angular.module("MyApp", ["ngAnimate"]);
app.controller('MyCtrl', function($scope) {
});
</script>
</body>
</html>

这是我的 bounceOut 动画 css 代码

@keyframes bounceOut {
20% {
transform: scale3d(.9, .9, .9);
}

50%, 55% {
opacity: 1;
transform: scale3d(1.1, 1.1, 1.1);
}

to {
opacity: 0;
transform: scale3d(.3, .3, .3);
}
}
.bounceOut {
animation-name: bounceOut;
}

这是我的放大动画 css 代码

@keyframes zoomIn {
from {
opacity: 0;
transform: scale3d(.3, .3, .3);
}

50% {
opacity: 1;
}
}
.zoomIn {
animation-name: zoomIn;
}

最佳答案

似乎您使用的是 css3 动画而不是 angularjs 动画。如果我觉得错了,请告诉我,但这应该有效,

/* Styles go here */

.zoomIn {
animation: zoomInf 5s infinite;
-webkit-animation: zoomInf 5s infinite;
}

@keyframes zoomInf {
from {
opacity: 0;
transform: scale3d(.3, .3, .3);
}
50% {
opacity: 1;
}
}

@-webkit-keyframes zoomInf {
from {
opacity: 0;
transform: scale3d(.3, .3, .3);
-webkit-transform: scale3d(.3, .3, .3);
}
50% {
opacity: 1;
}
}


@keyframes bounceOutf {
20% {
transform: scale3d(.9, .9, .9);
}
50%,
55% {
opacity: 1;
transform: scale3d(1.1, 1.1, 1.1);
}
to {
opacity: 0;
transform: scale3d(.3, .3, .3);
}
}


@-webkit-keyframes bounceOutf {
20% {
-webkit-transform: scale3d(.9, .9, .9);
}
50%,
55% {
opacity: 1;
-webkit-transform: scale3d(1.1, 1.1, 1.1);
}
to {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
}
}


.bounceOut {
animation: bounceOutf 5s infinite;
-webkit-animation: bounceOutf 5s infinite;
}

关于angularjs - Angular 动画不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35405742/

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