{"id":16208911,"url":"https://github.com/hon-key/thinkverb","last_synced_at":"2025-03-16T11:30:43.862Z","repository":{"id":56924163,"uuid":"166040180","full_name":"hon-key/ThinkVerb","owner":"hon-key","description":"A super cool animation interface based on CoreAnimation","archived":false,"fork":false,"pushed_at":"2021-03-16T09:49:33.000Z","size":582,"stargazers_count":107,"open_issues_count":1,"forks_count":20,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-27T08:18:49.989Z","etag":null,"topics":["animation","coreanimation","ios","objective-c","swift"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hon-key.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-16T12:55:19.000Z","updated_at":"2021-12-10T05:17:52.000Z","dependencies_parsed_at":"2022-08-21T05:20:57.900Z","dependency_job_id":null,"html_url":"https://github.com/hon-key/ThinkVerb","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hon-key%2FThinkVerb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hon-key%2FThinkVerb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hon-key%2FThinkVerb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hon-key%2FThinkVerb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hon-key","download_url":"https://codeload.github.com/hon-key/ThinkVerb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814864,"owners_count":20352037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","coreanimation","ios","objective-c","swift"],"created_at":"2024-10-10T10:26:23.687Z","updated_at":"2025-03-16T11:30:43.502Z","avatar_url":"https://github.com/hon-key.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/hon-key/ThinkVerb/blob/d5ad3fc25751bb9b388c97d0972f4c6ad4692414/Resources/logo.png\" width = \"100%\" /\u003e\n\n[![Cocoapods](https://img.shields.io/badge/pod-1.1.0-orange.svg)](https://img.shields.io/badge/pod-1.2.4-orange.svg)\n[![Platform](https://img.shields.io/badge/platform-iOS-lightgrey.svg)](https://img.shields.io/badge/platform-iOS-lightgrey.svg)\n[![Language](https://img.shields.io/badge/language-Objective--C-blue.svg)](https://img.shields.io/badge/language-Objective--C-blue.svg)\n\n[English Introduction](https://github.com/hon-key/ThinkVerb/blob/master/README_EN.md)\n\n# ThinkVerb\nThinkVerb 是一组基于 CoreAnimation 的 API，相比与直接使用 CoreAnimation，ThinkVerb 通过链式语法进行编程，并且自管理 CAAnimation，你无需自己手动创建任何 CAAnimation 并将其添加到视图上。\n\n得益于此，ThinkVerb 可以用非常少的代码快速生成基础动画，不单单如此，你所写的代码还相当可读而易于维护。\n\n目前 ThinkVerb 的功能几乎涵盖了所有的基础动画，你可以轻松通过多个基础动画的组合来生成一个复杂的动画。如果用原生代码，你可能需要大量代码来完成此工作，但是用 ThinkVerb，你则可以在短短几行代码里完成相同的工作量。\n\n# Usage\nThinkVerb 很简单，它只有一个入口，那就是 ThinkVerb 扩展 UIView 的一个属性：TVAnimation。\n\nTVAnimation 管理所有的动画单元，我们称动画单元为 Sprite，你需要做的只有：通过 TVAnimation 创建 sprite，配置 sprite，最后 activate sprite。\n这样，动画就被激活，UIView 将自动开始动画。\n\n#### 例如，如果你想永不停息地旋转你的 UIView，你只需要下面这一句代码：\n```\nNSString *rotation = view.TVAnimation.rotate.z.endAngle(M_PI * 2).repeat(-1).activate();\n```\n或者，如果你想为你创建的 sprite 定义你自己想要的名字，你可以这么写:\n```\nview.TVAnimation.rotate.z.endAngle(M_PI * 2).repeat(-1).activateAs(@\"rotation\");\n```\n\n这行代码会绕着 z 轴旋转你的 UIView，其旋转角度是从 UIView 当前的角度旋转到 M_PI * 2，假设当前角度是 0，那就是转一圈。**`repeat(-1)`** 能够让 sprite 无限重复。最后，调用 **`activate()`** 就等于激活了该动画。\n\n#### 通常情况下，如果你没有让 sprite 永远重复下去，或者没有让 sprite 在动画结束时停留，sprite 会自动被移除并释放，而如上面的例子，你需要手动移除该动画:\n```\nview.TVAnimation.clear();\n```\n#### 上面一行代码移除 view 的所有动画，通常情况下，你调用这一行代码就够了，如果你不想对 view 的其他动画造成影响，你可以只移除相应的动画:\n```\nview.TVAnimation.existSprite(rotation).stop();\n```\n\n如果你自己定义了名字，你可以这么做:\n```\nview.TVAnimation.existSprite(@\"rotation\").stop();\n```\n\n这样，旋转会停止，sprite 会被移除并释放，否则，就算 view 释放掉了，sprite 也不会被释放，从而造成内存泄漏。\n\n你可以通过 ThinkVerbDemo 看到更多的例子。\n\nThinkVerb 做复杂动画也是相当轻松的，你甚至可以写出一把手枪来:\n\n```\nview.TVAnimation.appearance.duration(3).timing(TVTiming.extremeEaseOut).end();\nview.TVAnimation.contents.drawRange(nil,[UIImage imageNamed:@\"1\"]).didStop(^{\n    view.TVAnimation.contents.drawRange([UIImage imageNamed:@\"1\"],[UIImage imageNamed:@\"2\"]).didStop(^{\n        view.TVAnimation.contents.drawRange([UIImage imageNamed:@\"2\"],[UIImage imageNamed:@\"3\"]).didStop(^{\n            view.TVAnimation.contents.drawRange([UIImage imageNamed:@\"3\"],[UIImage imageNamed:@\"2\"]).activate();\n        }).activate();\n    }).activate();\n}).activate();\n```\n\n\n\n# Installation\n## Using cocoapods\n```\npod 'ThinkVerb'\n```\n\n# 版本信息\n当前版本：1.1.0\n\n更新:\n\n适配 iOS 8\n\n## Copy files\n拷贝子 ThinkVerb 文件夹下的所有源码到你的工程\n\n# Indexes\n\n* ### Basic\n\n    - [**move**](#move) **`从某个点移动 view 到另一个点`**\n\n    - [**scale**](#scale) **`将 view 缩放到某个倍数`**\n\n    - [**rotate**](#rotate) **`围绕 x/y/z 轴旋转 view`**\n\n    - [**shadow**](#shadow) **`对 shadow 的 offset/opacity/radius/color 做动画,`**\n\n    - [**bounds**](#bounds) **`对 view 的 bounds 做动画，注意该动画效果取决于 anchorPoint `**\n\n    - [**anchor**](#anchor) **`对 view 的 anchorPoint 做动画，单独进行不会有任何效果，需要和相关的动画组合才会有效果`**\n\n    - [**translate**](#translate) **`通过偏移来移动动画，基于 Transform3D，所以你可以将它应用到 sublayer 上`**\n\n    - [**fade**](#fade) **`淡入淡出`**\n    \n    - [**contents**](#contents) **`对 cotnents 属性做动画，如 rect属性会对位图的渲染范围做动画，范围在 [0 0 1 1] 内`**\n\n    - [**backgroundColor**](#backgroundColor) **`背景变换`**\n\n    - [**cornerRadius**](#cornerRadius) **`圆角动画`**\n\n    - [**border**](#border) **`对 view 的边框的宽度和颜色做动画`**\n\n    - [**path**](#path) **`对 view 做关键帧动画，可通过贝塞尔控制点生成曲线动画`**\n    \n    - [**basicCustom**](#path) **`对 view 做自定义动画，可快速对自定义layer进行动画控制`**\n\n* ### Appearance\n    appearance sprite 可以用来对某个 view 配置默认参数，如果你想让某个 view 的所有 sprite 默认在动画结束时停留而不移除，你可以在生成 sprite 之前写:\n    ```\n    view.TVAnimation.appearance.keepAlive(YES).end();\n    ```\n\n\n\n## License\n\nThinkVerb is released under the MIT license. See [LICENSE](https://github.com/hon-key/ThinkVerb/blob/master/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhon-key%2Fthinkverb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhon-key%2Fthinkverb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhon-key%2Fthinkverb/lists"}