{"id":771,"date":"2020-09-01T11:09:25","date_gmt":"2020-09-01T03:09:25","guid":{"rendered":"https:\/\/badgameshow.com\/fly\/?p=771"},"modified":"2021-03-19T09:35:05","modified_gmt":"2021-03-19T01:35:05","slug":"android-property-animation%e5%b1%ac%e6%80%a7%e5%8b%95%e7%95%ab%e6%95%99%e5%ad%b8","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/fly\/android-property-animation%e5%b1%ac%e6%80%a7%e5%8b%95%e7%95%ab%e6%95%99%e5%ad%b8\/","title":{"rendered":"Android Property Animation(\u5c6c\u6027\u52d5\u756b)\u6559\u5b78"},"content":{"rendered":"<h3>1.\u5e73\u79fb<\/h3>\n<h4>X\u8ef8<\/h4>\n<pre><code class=\"language-Kotlin line-numbers\">translateX.setOnClickListener {\n    ObjectAnimator.ofFloat(icon, \"translationX\", 0f,200f,-200f,0f).setDuration(2000).start()\n}\n<\/code><\/pre>\n<h4>Y\u8ef8<\/h4>\n<pre><code class=\"language-Kotlin line-numbers\">translateY.setOnClickListener {\n    ObjectAnimator.ofFloat(icon, \"translationY\", 0f,200f,-200f,0f).setDuration(2000).start()\n}\n<\/code><\/pre>\n<h3>2.\u900f\u660e\u5ea6<\/h3>\n<pre><code class=\"language-Kotlin line-numbers\">alpha.setOnClickListener {\n    ObjectAnimator.ofFloat(icon, \"alpha\", 0f,1f,0f,1f).setDuration(2000).start()\n}\n<\/code><\/pre>\n<h3>3.\u7e2e\u653e<\/h3>\n<h4>X\u8ef8<\/h4>\n<pre><code class=\"language-Kotlin line-numbers\">scaleX.setOnClickListener {\n    ObjectAnimator.ofFloat(icon, \"scaleX\", 1f,3f,1f).setDuration(2000).start()\n}\n<\/code><\/pre>\n<h4>Y\u8ef8<\/h4>\n<pre><code class=\"language-Kotlin line-numbers\">scaleY.setOnClickListener {\n    ObjectAnimator.ofFloat(icon, \"scaleY\", 1f,3f,1f).setDuration(2000).start()\n}\n<\/code><\/pre>\n<h4>X\u8ef8+Y\u8ef8<\/h4>\n<pre><code class=\"language-Kotlin line-numbers\">scale.setOnClickListener {\n    ObjectAnimator.ofFloat(icon, \"scaleX\", 1f,3f,1f).setDuration(2000).start()\n    ObjectAnimator.ofFloat(icon, \"scaleY\", 1f,3f,1f).setDuration(2000).start()\n}\n<\/code><\/pre>\n<h3>4.\u65cb\u8f49<\/h3>\n<h4>X\u8ef8<\/h4>\n<pre><code class=\"language-Kotlin line-numbers\">rotateX.setOnClickListener {\n    ObjectAnimator.ofFloat(icon, \"rotationX\", 0f, 360f).setDuration(1000).start()\n}\n<\/code><\/pre>\n<h4>Y\u8ef8<\/h4>\n<pre><code class=\"language-Kotlin line-numbers\">rotateY.setOnClickListener {\n    ObjectAnimator.ofFloat(icon, \"rotationY\", 0f, 360f).setDuration(1000).start()\n}\n<\/code><\/pre>\n<h4>\u81ea\u8f49<\/h4>\n<pre><code class=\"language-Kotlin line-numbers\">rotate.setOnClickListener {\n    ObjectAnimator.ofFloat(icon, \"rotation\", 0f, 360f).setDuration(1000).start()\n}\n<\/code><\/pre>\n<h3>5.\u81ea\u5b9a\u7fa9<\/h3>\n<pre><code class=\"language-Kotlin line-numbers\">textColor.setOnClickListener {\n    val textColor = ObjectAnimator.ofInt(it, \"textColor\", Color.RED, Color.YELLOW)\n    textColor.repeatMode = ValueAnimator.REVERSE \/\/\u985b\u5012\n    textColor.repeatCount = -1 \/\/\u7121\u9650\u91cd\u8907\n    textColor.duration = 3000;\n    textColor.start()\n}\n<\/code><\/pre>\n<h3>6.\u540c\u6642\u57f7\u884c<\/h3>\n<pre><code class=\"language-Kotlin line-numbers\">icon.setOnClickListener {\n    val rotate =ObjectAnimator.ofFloat(icon, \"rotation\", 0f, 360f)\n    val scaleX = ObjectAnimator.ofFloat(icon, \"scaleX\", 1f,3f,1f)\n    val scaleY = ObjectAnimator.ofFloat(icon, \"scaleY\", 1f,3f,1f)\n\n    val set = AnimatorSet()\n    set.duration = 1000\n    set.playTogether(rotate, scaleX, scaleY)\n    set.start()\n}\n<\/code><\/pre>\n<h3>7.\u6548\u679c\u5c55\u793a<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/badgameshow.com\/fly\/wp-content\/uploads\/2020\/09\/video-1598938001.gif\" alt=\"\" \/><\/p>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>1.\u5e73\u79fb X\u8ef8 translateX.setOnClickListener { ObjectAnimator. &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[5],"tags":[13,29,15],"class_list":["post-771","post","type-post","status-publish","format-standard","hentry","category-android","tag-android","tag-animation","tag-kotlin"],"_links":{"self":[{"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/posts\/771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/comments?post=771"}],"version-history":[{"count":12,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/posts\/771\/revisions"}],"predecessor-version":[{"id":1271,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/posts\/771\/revisions\/1271"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/media?parent=771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/categories?post=771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/fly\/wp-json\/wp\/v2\/tags?post=771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}