{"id":238392,"date":"2023-12-26T06:50:16","date_gmt":"2023-12-25T22:50:16","guid":{"rendered":"https:\/\/www.idc.net\/help\/238392\/"},"modified":"2023-12-26T06:50:16","modified_gmt":"2023-12-25T22:50:16","slug":"css%e5%85%a5%e9%97%a8-animation-direction%ef%bc%88%e5%8a%a8%e7%94%bb%e6%96%b9%e5%90%91%ef%bc%89","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/238392\/","title":{"rendered":"Css\u5165\u95e8: animation-direction\uff08\u52a8\u753b\u65b9\u5411\uff09"},"content":{"rendered":"<p>  <title id=\"css%e5%85%a5%e9%97%a8-animation-direction%ef%bc%88%e5%8a%a8%e7%94%bb%e6%96%b9%e5%90%91%ef%bc%89-lhzYCrYQCR\">Css\u5165\u95e8: animation-direction\uff08\u52a8\u753b\u65b9\u5411\uff09<\/title><\/p>\n<h1 id=\"css%e5%85%a5%e9%97%a8-animation-direction%ef%bc%88%e5%8a%a8%e7%94%bb%e6%96%b9%e5%90%91%ef%bc%89-lhzYCrYQCR\">Css\u5165\u95e8: animation-direction\uff08\u52a8\u753b\u65b9\u5411\uff09<\/h1>\n<h2 id=\"%e4%bb%80%e4%b9%88%e6%98%afanimation-direction-lhzYCrYQCR\">\u4ec0\u4e48\u662fanimation-direction<\/h2>\n<p>animation-direction\u5c5e\u6027\u7528\u4e8e\u6307\u5b9aCSS\u52a8\u753b\u64ad\u653e\u7684\u65b9\u5411\u3002\u5b83\u53ef\u4ee5\u63a7\u5236\u52a8\u753b\u662f\u6b63\u5411\u64ad\u653e\u8fd8\u662f\u53cd\u5411\u64ad\u653e\u3002<\/p>\n<h2 id=\"animation-direction%e7%9a%84%e5%8f%96%e5%80%bc-lhzYCrYQCR\">animation-direction\u7684\u53d6\u503c<\/h2>\n<p>animation-direction\u5c5e\u6027\u53ef\u4ee5\u53d6\u4ee5\u4e0b\u51e0\u4e2a\u503c\uff1a<\/p>\n<ul>\n<li><strong>normal<\/strong>: \u9ed8\u8ba4\u503c\uff0c\u52a8\u753b\u6b63\u5411\u64ad\u653e\u3002<\/li>\n<li><strong>reverse<\/strong>: \u52a8\u753b\u53cd\u5411\u64ad\u653e\u3002<\/li>\n<li><strong>alternate<\/strong>: \u52a8\u753b\u5728\u6b63\u5411\u548c\u53cd\u5411\u4e4b\u95f4\u4ea4\u66ff\u64ad\u653e\u3002<\/li>\n<li><strong>alternate-reverse<\/strong>: \u52a8\u753b\u5728\u53cd\u5411\u548c\u6b63\u5411\u4e4b\u95f4\u4ea4\u66ff\u64ad\u653e\u3002<\/li>\n<\/ul>\n<h2 id=\"%e4%bd%bf%e7%94%a8animation-direction-lhzYCrYQCR\">\u4f7f\u7528animation-direction<\/h2>\n<p>\u8981\u4f7f\u7528animation-direction\u5c5e\u6027\uff0c\u9700\u8981\u5148\u5b9a\u4e49\u4e00\u4e2aCSS\u52a8\u753b\uff1a<\/p>\n<pre><code>\n    @keyframes myAnimation {\n      0% { opacity: 0; }\n      100% { opacity: 1; }\n    }\n  <\/code><\/pre>\n<p>\u7136\u540e\u5c06animation-direction\u5c5e\u6027\u5e94\u7528\u4e8e\u5143\u7d20\uff1a<\/p>\n<pre><code>\n    .myElement {\n      animation-name: myAnimation;\n      animation-duration: 2s;\n      animation-direction: reverse;\n    }\n  <\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c.myElement\u5143\u7d20\u5c06\u4ee5\u53cd\u5411\u64ad\u653e\u7684\u65b9\u5f0f\u5e94\u7528myAnimation\u52a8\u753b\u3002<\/p>\n<h2 id=\"%e7%a4%ba%e4%be%8b-lhzYCrYQCR\">\u793a\u4f8b<\/h2>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528animation-direction\u7684\u793a\u4f8b\uff1a<\/p>\n<pre><code>\n    .box {\n      width: 100px;\n      height: 100px;\n      background-color: red;\n      animation-name: myAnimation;\n      animation-duration: 2s;\n      animation-direction: alternate;\n    }\n\n    @keyframes myAnimation {\n      0% { transform: translateX(0); }\n      100% { transform: translateX(200px); }\n    }\n  <\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c.box\u5143\u7d20\u5c06\u4ee5\u6b63\u5411\u548c\u53cd\u5411\u4ea4\u66ff\u64ad\u653e\u7684\u65b9\u5f0f\u79fb\u52a8\u3002<\/p>\n<h2 id=\"%e6%80%bb%e7%bb%93-lhzYCrYQCR\">\u603b\u7ed3<\/h2>\n<p>animation-direction\u5c5e\u6027\u662fCSS\u52a8\u753b\u4e2d\u7684\u4e00\u4e2a\u91cd\u8981\u5c5e\u6027\uff0c\u5b83\u53ef\u4ee5\u63a7\u5236\u52a8\u753b\u7684\u64ad\u653e\u65b9\u5411\u3002\u901a\u8fc7\u8bbe\u7f6e\u4e0d\u540c\u7684\u53d6\u503c\uff0c\u53ef\u4ee5\u5b9e\u73b0\u4e0d\u540c\u7684\u52a8\u753b\u6548\u679c\u3002<\/p>\n<h2 id=\"%e9%a6%99%e6%b8%af%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%a6%96%e9%80%89%e5%90%8e%e6%b5%aa%e4%ba%91-lhzYCrYQCR\">\u9999\u6e2f\u670d\u52a1\u5668\u9996\u9009\u540e\u6d6a\u4e91<\/h2>\n<p>\u540e\u6d6a\u4e91\u63d0\u4f9b\u9ad8\u8d28\u91cf\u7684\u9999\u6e2f\u670d\u52a1\u5668\uff0c\u4e3a\u60a8\u7684\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u7a33\u5b9a\u53ef\u9760\u7684\u6258\u7ba1\u670d\u52a1\u3002\u70b9\u51fb<a href=\"https:\/\/idc.net\">\u8fd9\u91cc<\/a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Css\u5165\u95e8: animation-direction\uff08\u52a8\u753b\u65b9\u5411\uff09 Css\u5165\u95e8: animation-direc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[197854],"tags":[],"class_list":["post-238392","post","type-post","status-publish","format-standard","hentry","category-html"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/238392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=238392"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/238392\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=238392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=238392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=238392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}