LayaAir引擎——(三)
2024-10-19 11:52:50
LyaAir引擎(JavaScript)实现图片的翻转一半
图片4.png位于bin/开场过渡 文件夹下,图片大小150*30(根据实际情况做调整)
var button;
var scale1 = 1; button = new laya.display.Sprite()
button.pos(100,100);
button.pivot(75,15);
button.loadImage("开场过渡/4.png");
Laya.stage.addChild(button); //实现图片X轴翻转一半
Laya.timer.frameLoop(1,this,animateX);
//实现图片Y轴翻转一半
//Laya.timer.frameLoop(1,this,animateY); function animateX() { if ( (scale1 - 0.02) < -0.04) {
Laya.timer.clear(this,animateX);
}else{
button.scale(scale1,1);
scale1 -= 0.02;
}
} function animateY() { if ( (scale1 - 0.02) < -0.04) {
Laya.timer.clear(this,animateY);
}else{
button.scale(1,scale1);
scale1 -= 0.02;
}
}
最新文章
- Java中Sting类型对象内容不可改变
- 2. Transcribing DNA into RNA
- iOS block 声明时和定义时的不同格式
- c++ static及const(开发者在线)
- JS函数创建的具体过程
- 求和问题总结(leetcode 2Sum, 3Sum, 4Sum, K Sum)
- javascript 面向对象技术
- android中画文字的换行 办法(对于遇到canvas.drawText(String s )无法实现换行问题的解决)
- node.js入门(二) 第一个程序 Hello World
- 【科研论文】基于文件解析的飞行器模拟系统软件设计(应用W5300)
- ionic2 tabs使用自定义图标
- 【SpringMVC】XML配置说明
- HDU 1068 Girls and Boys(模板——二分图最大匹配)
- Vue第一个自定义组件:数字输入框(number-input)
- txn.go
- 使用react全家桶制作博客后台管理系统
- Google Protocol Buffer项目无法加载解决方案
- ISCC:Please give me username and password!
- NoSQL&;Redis
- windows下vc编译和debug nginx