aardio - 【库】缓动库

godking.slowMotion 缓动库

下载地址: http://chengxu.online → aardio资源下载 → slowMotion.rar

集成了33种基于曲线补间动画算法,对于做UI动画的人可能会非常有帮助,对于组件的移动、缩放等效果处理,非常有用。

缓动效果:

aardio - 【库】缓动库_第1张图片

 

 实例代码

import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=1199;bottom=899)
winform.add()
/*}}*/

winform.show();
import godking.paint
import godking.slowMotion
var p = godking.paint(200*6,150*6,0xFFFFFFFF);
	p.offsetMode =false
for(y=1;6;1){
	for(x=1;6;1){
		var l = (x-1)*200;
		var t = (y-1)*150;
		var index = (y-1)*6+x;
		if index>33 break 2;
		var funcname = index++":"++godking.slowMotion.types[index].name++" ("++godking.slowMotion.types[index].name1++")  "++godking.slowMotion.types[index].memo
		p.drawRectF(l,t,200,150,0xFF000000,1);
		p.drawTextF(l+2,t+2/*y1*/,/*x2*/200,100/*y2*/,funcname,::LOGFONT(name="宋体";h=12;color=0xFF000000;brush=null),0,0,0);
		p.drawLine(l,t+20,l+200,t+20,0xFF00FFDD,1/*线宽*/);
		p.drawLine(l,t+130,l+200,t+130,0xFF00FFDD,1/*线宽*/);
		var sm = godking.slowMotion(index/*缓动类型*/, false/*按值*/, /*开始值*/, /*结束值*/, /*当前值或进度*/)
		for(n=1;200;1){
			var my = sm(t+20/*开始数值*/,t+130/*结束数值*/,n/200);
			p.setPixel(l+n,my,0xFFFF0000/*颜色ARGB*/);
		}
		winform.add(
			["button"++index]={cls="plus";text="➡";left=l;top=t+50;right=l+20;bottom=t+70;z=2;bgcolor=255;color=65535;notify=1;};
		)
		winform["button"++index].oncommand = function(){
			for(i=0;50;1){
				var my = sm( l/*开始值*/, l+180/*结束值*/,i/50 /*当前值或进度*/)
				owner.setPos(my,t+50)
				owner.redraw()
				win.delay(1)
			}
		}
	}
}
winform.setBitmap(p.bitmap.copyHandle())
winform.redraw()
win.loopMessage();

你可能感兴趣的:(aardio,库,aardio)