godking.motion 缓动库一例

光庆 17天前 318


感谢网友 Roy 提供的源码!

godking.slowMotion 库 改名为 godking.motion 库,功能未变。

import fonts.fontAwesome;
import win.ui;
import godking.motion;
/*DSG{{*/
mainForm = win.form(text="测试";right=757;bottom=467;composited=1)
mainForm.add(
button={cls="button";text="Button";left=608;top=168;right=712;bottom=200;z=13};
checkbox={cls="checkbox";text="Checkbox";left=496;top=176;right=592;bottom=192;z=12};
combobox={cls="combobox";left=112;top=16;right=424;bottom=40;edge=1;items={};mode="dropdownlist";vscroll=1;z=14};
edit={cls="edit";left=64;top=112;right=712;bottom=168;autohscroll=false;autovscroll=false;hidesel=1;multiline=1;readonly=1;z=2};
groupbox={cls="groupbox";left=48;top=96;right=728;bottom=208;edge=1;z=1};
plus={cls="plus";text='\uF054';left=696;top=60;right=720;bottom=84;dl=1;dt=1;font=LOGFONT(h=-18;name='FontAwesome');notify=1;z=7};
plus2={cls="plus";text='\uF078';left=696;top=60;right=720;bottom=84;dl=1;dt=1;font=LOGFONT(h=-18;name='FontAwesome');notify=1;z=8};
radiobutton={cls="radiobutton";text="Radiobutton";left=392;top=176;right=488;bottom=192;z=11};
static={cls="static";text="缓动效果:";left=48;top=24;right=128;bottom=40;transparent=1;z=3};
static2={cls="static";text="相关设置";left=48;top=104;right=152;bottom=136;dl=1;dt=1;transparent=1;z=4};
static3={cls="static";text="显示功能";left=48;top=64;right=152;bottom=80;dl=1;dt=1;transparent=1;z=5};
static4={cls="static";text="Static";left=48;top=90;right=728;bottom=91;bgcolor=8421504;dl=1;dt=1;z=6};
static5={cls="static";text="总步数:";left=432;top=24;right=488;bottom=40;transparent=1;z=9};
time={cls="edit";text="6";left=488;top=16;right=560;bottom=40;edge=1;multiline=1;num=1;z=10}
)
/*}}*/

mainForm.edit.text = "科技行业的脱钩潮流正在掀起全球范围内的热议,英特尔、高通、英伟达等知名科技巨头相继宣布解除过去的合作关系,各自为战。这一决定引发了业界的广泛关注和猜测,究竟是什么原因促使了这些曾经合作密切的公司选择脱钩?这是否意味着科技行业即将迎来一场深刻的变革?";
mainForm.groupbox.group();
mainForm.groupbox.height = 0;

mainForm.plus.oncommand = function(id,event){
    mainForm.plus.hide = true;
    mainForm.plus2.hide = false;
    mainForm.groupbox.show(true);
    var sm = godking.motion(mainForm.combobox.selIndex/*缓动类型*/, false/*按值*/, /*开始值*/, /*结束值*/, /*当前值或进度*/);
    var t = tonumber(mainForm.time.text);
    for(i=1;t;1){
        var my = sm( 8/*开始值*/, 112/*结束值*/,i/t /*当前值或进度*/)
        mainForm.groupbox.height = my;
        var my2 = sm( 104/*开始值*/, 104+128/*结束值*/,i/t /*当前值或进度*/)
        mainForm.static2.setPos(48, my2);
        win.delay(40);
    }
}

mainForm.plus2.oncommand = function(id,event){
    mainForm.plus2.hide = true;
    mainForm.plus.hide = false;
    var sm = godking.motion(mainForm.combobox.selIndex/*缓动类型*/, false/*按值*/, /*开始值*/, /*结束值*/, /*当前值或进度*/);
    var t = tonumber(mainForm.time.text);
    for(i=1;t;1){
        var my = sm( 112/*开始值*/, 8/*结束值*/,i/t /*当前值或进度*/)
        mainForm.groupbox.height = my;
        var my2 = sm( 104+128/*开始值*/, 104/*结束值*/,i/t /*当前值或进度*/)
        mainForm.static2.setPos(48, my2);
        win.delay(40);
    }
    mainForm.groupbox.show(false);
    mainForm.redraw();
    if mainForm.combobox.selIndex==mainForm.combobox.count mainForm.combobox.selIndex=1;
    else mainForm.combobox.selIndex++;
}
for(i=1;#godking.motion.types;1){
	mainForm.combobox.add(i+":"+godking.motion.types[i].name+"("+godking.motion.types[i].name1+")"+godking.motion.types[i].memo)
}
mainForm.plus2.hide = true;
mainForm.combobox.selIndex=1;
mainForm.show();
return win.loopMessage();


最新回复 (2)
  • Xmzzz 17天前
    0 2

    又get到一技能包,顶

  • 小光芒 16天前
    0 3
    原理是啥,我挺好奇
返回