剑气纵横-autojs动画
牙叔教程 简单易懂
"ui";
engines.all().map((ScriptEngine) => {if (engines.myEngine().toString() !== ScriptEngine.toString()) {ScriptEngine.forceStop();}
});
importClass("android.animation.ValueAnimator");
importClass("android.content.Context");
importClass("android.graphics.Matrix");
importClass("android.graphics.PorterDuffXfermode");
importClass("android.graphics.PorterDuff");
importClass("android.graphics.Color");
importClass("android.util.AttributeSet");
importClass("android.view.View");
importClass("android.view.animation.RotateAnimation");
ui.layout(<vertical><canvas id="board"></canvas></vertical>
);// 设置画笔参数
let paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Paint.Style.FILL);
color = colors.parseColor("#ffffff");
paint.setColor(color);// 设置动画参数
let anim = ValueAnimator.ofFloat(0, -360);
anim.repeatCount = android.view.animation.Animation.INFINITE;
anim.setDuration(1000);
anim.setInterpolator(null);
anim.start();
let camera = android.graphics.Camera();
let rotateMatrix = Matrix();
let xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OUT);
/* -------------------------------------------------------------------------- */
ui.post(function () {let width = ui.board.getWidth();let height = ui.board.getHeight();// log(width.toFloat());ui.board.on("draw", function (canvas) {canvas.drawColor(Color.BLACK);color = "#ff0000";drawSword(canvas, 35, -45, 0, width, height, color);color = "#00ff00";drawSword(canvas, 50, 10, 120, width, height, color);color = "#0000ff";drawSword(canvas, 35, 55, 240, width, height, color);});
});function drawSword(canvas, rotateX, rotateY, startValue, width, height, color) {let colorNum = colors.parseColor(color);paint.setColor(colorNum);let layerId = canvas.saveLayer(0, 0, width, height, null, android.graphics.Canvas.ALL_SAVE_FLAG);rotateMatrix.reset();camera.save();/* ----------------相机旋转---------------------------------------------------------- */camera.rotateX(rotateX);camera.rotateY(rotateY);camera.rotateZ(anim.animatedValue + startValue);camera.getMatrix(rotateMatrix);camera.restore();/* -------------------------------------------------------------------------- */let halfW = width / 2;let halfH = height / 2;let radius = Math.min(width, height) / 4;rotateMatrix.preTranslate(-halfW, -halfH);rotateMatrix.postTranslate(halfW, halfH);canvas.concat(rotateMatrix);canvas.drawCircle(halfW, halfH, radius, paint);paint.xfermode = xfermode;canvas.drawCircle(halfW, halfH - 0.05 * radius, radius * 1.01, paint);canvas.restoreToCount(layerId);paint.xfermode = null;
}
活动
官方渠道免费领取爱奇艺7天vip会员,真实有效!!!
参考
Android 炫酷自定义 View - 剑气加载
名人名言
思路是最重要的, 其他的百度, bing, stackoverflow, 安卓文档, autojs文档, 最后才是群里问问
— 牙叔教程
声明
部分内容来自网络
本教程仅用于学习, 禁止用于其他用途
bilibili
牙叔教程
微信公众号 牙叔教程
QQ群
747748653
剑气纵横-autojs动画相关推荐
- AutoJs学习-实现悬浮窗动画和滑动
往期文章分享 点击跳转=><导航贴>- Unity手册,系统实战学习 点击跳转=><导航贴>- Android手册,重温移动开发
- AutoJs学习-修改王者荣耀启动动画
往期文章分享 点击跳转=><导航贴>- Unity手册,系统实战学习 点击跳转=><导航贴>- Android手册,重温移动开发
- AutoJs学习-属性动画ObjectAnimator
往期文章分享 点击跳转=><导航贴>- Unity手册,系统实战学习 点击跳转=><导航贴>- Android手册,重温移动开发
- autojs之大柒侧滑栏详解
使用场景 解析 大柒 侧滑栏 效果展示 缘由 大柒做UI很棒, 以前他在群里分享过这个侧滑栏, 虽然一直没有能用到这个侧滑栏的机会, 但是还是想看看他怎么做的 autoj版本 代码讲解 布局 整体就是 ...
- autojs 悬浮框演示代码
很多人在写autojs的时候,都是没有界面的,所以就少了很多智能化操作,这一节给大家分享一段代码,如何使用悬浮框. var 悬浮控制 = function(window, windowid, ar) ...
- autojs 开发文档集合
加入我们的QQ群553908361,和各作者同群交流 教程会优先发布于收费脚本v群. 该代码选自于aj开发者的文档,群里有人反馈开发文档打开慢.所以做了这个.方便搜索.如有侵权,请私信我进行删除 同时 ...
- autojs自定义Switch
牙叔教程 简单易懂 使用场景 自定义控件 效果展示 autojs版本 8.8.20-0 为什么自定义控件 为了UI界面漂亮 怎样自定义控件 autojs软件自带的示例 / 界面控件 / 自定义控件 , ...
- 【Auto.JS】Autojs官方提取文档使用说明函数 (2)
接上一篇文章:Autojs官方提取文档使用说明函数 (1) Images Stability: 2 - Stable images模块提供了一些手机设备中常见的图片处理函数,包括截图.读写图片.图片剪 ...
- autojs简洁的登录界面
牙叔教程 简单易懂 效果展示 界面特点 输入框使用TextInputEditText, 上方可显示hint文字, 填写不正确, 右侧下方会提示错误 按钮点击添加动画 autojs版本 9.0.4 你将 ...
最新文章
- 五大存储模型关系模型、键值存储、文档存储、列式存储、图形数据
- 对比Javascript和TypeScript
- 物理约束相关问题梳理
- COM 组件设计与应用(十一)—— IDispatch 及双接口的调用
- JSON.NET 简单的使用
- 高可用架构设计之道,实战案例直面流量洪峰
- Linux 系统管理
- Visio 图案填充-设置形状格式
- SpringMVC之安全性(一)
- 餐厅小票打印模板_收银系统小票标签设置
- java 处理表情字符_使用轻量级工具emoji-java处理emoji表情字符
- RAID技术全解图解-RAID0、RAID1、RAID5、RAID100【转】
- 钱不是最重要的:谈谈创业起步如何找钱?
- vnpy2.0 探索(一)
- 腾讯公司移动互联网的运营与营销
- 趣学PYTHON 第一章python不是大蟒蛇
- Python打印空心等腰三角形
- 前端开发:Vue项目报错NavigationDuplicated:Avoided redundant navigation to current location:“/XXX”的解决方法
- 80后要坚守的人生底线
- 解线性方程组的直接法