牙叔教程 简单易懂

"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动画相关推荐

  1. AutoJs学习-实现悬浮窗动画和滑动

    往期文章分享 点击跳转=><导航贴>- Unity手册,系统实战学习 点击跳转=><导航贴>- Android手册,重温移动开发

  2. AutoJs学习-修改王者荣耀启动动画

    往期文章分享 点击跳转=><导航贴>- Unity手册,系统实战学习 点击跳转=><导航贴>- Android手册,重温移动开发

  3. AutoJs学习-属性动画ObjectAnimator

    往期文章分享 点击跳转=><导航贴>- Unity手册,系统实战学习 点击跳转=><导航贴>- Android手册,重温移动开发

  4. autojs之大柒侧滑栏详解

    使用场景 解析 大柒 侧滑栏 效果展示 缘由 大柒做UI很棒, 以前他在群里分享过这个侧滑栏, 虽然一直没有能用到这个侧滑栏的机会, 但是还是想看看他怎么做的 autoj版本 代码讲解 布局 整体就是 ...

  5. autojs 悬浮框演示代码

    很多人在写autojs的时候,都是没有界面的,所以就少了很多智能化操作,这一节给大家分享一段代码,如何使用悬浮框. var 悬浮控制 = function(window, windowid, ar) ...

  6. autojs 开发文档集合

    加入我们的QQ群553908361,和各作者同群交流 教程会优先发布于收费脚本v群. 该代码选自于aj开发者的文档,群里有人反馈开发文档打开慢.所以做了这个.方便搜索.如有侵权,请私信我进行删除 同时 ...

  7. autojs自定义Switch

    牙叔教程 简单易懂 使用场景 自定义控件 效果展示 autojs版本 8.8.20-0 为什么自定义控件 为了UI界面漂亮 怎样自定义控件 autojs软件自带的示例 / 界面控件 / 自定义控件 , ...

  8. 【Auto.JS】Autojs官方提取文档使用说明函数 (2)

    接上一篇文章:Autojs官方提取文档使用说明函数 (1) Images Stability: 2 - Stable images模块提供了一些手机设备中常见的图片处理函数,包括截图.读写图片.图片剪 ...

  9. autojs简洁的登录界面

    牙叔教程 简单易懂 效果展示 界面特点 输入框使用TextInputEditText, 上方可显示hint文字, 填写不正确, 右侧下方会提示错误 按钮点击添加动画 autojs版本 9.0.4 你将 ...

最新文章

  1. 五大存储模型关系模型、键值存储、文档存储、列式存储、图形数据
  2. 对比Javascript和TypeScript
  3. 物理约束相关问题梳理
  4. COM 组件设计与应用(十一)—— IDispatch 及双接口的调用
  5. JSON.NET 简单的使用
  6. 高可用架构设计之道,实战案例直面流量洪峰
  7. Linux 系统管理
  8. Visio 图案填充-设置形状格式
  9. SpringMVC之安全性(一)
  10. 餐厅小票打印模板_收银系统小票标签设置
  11. java 处理表情字符_使用轻量级工具emoji-java处理emoji表情字符
  12. RAID技术全解图解-RAID0、RAID1、RAID5、RAID100【转】
  13. 钱不是最重要的:谈谈创业起步如何找钱?
  14. vnpy2.0 探索(一)
  15. 腾讯公司移动互联网的运营与营销
  16. 趣学PYTHON 第一章python不是大蟒蛇
  17. Python打印空心等腰三角形
  18. 前端开发:Vue项目报错NavigationDuplicated:Avoided redundant navigation to current location:“/XXX”的解决方法
  19. 80后要坚守的人生底线
  20. 解线性方程组的直接法

热门文章

  1. Keras深度学习实战(37)——手写文字识别
  2. CF1463-A. Dungeon
  3. 萌娃人脸生成器 实践踩坑笔记
  4. 基于华为巴龙MH5000-31 5G工业/商业模组开发(二)
  5. Android面试题收集(有具体答案)
  6. 战争军事历史纪录片收集
  7. ipad上的人体模型_我拥有哪种iPad模型?
  8. J9数字论:DAO与Web3的联系
  9. 炉石传说 历代无面斩杀宇宙龙术
  10. 思维转换--等价换位思考