Flash AS:模仿画笔的动画效果实例 -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【www.unjs.com - 电脑资料】

   

    效果如下:

   

    [AS]

    粗度 = 1;

    颜色 = "0x000000";

    色 = new Array("0x000000","0xff0000","0x00ff00","0x0000ff","0xffff00","0x00ffff","0xff00ff");

    for(i=0;i<=6;i++){

    attachMovie("色块","色块"+i,-i,{p:i})

    with(this["色块"+i]){

    _y = 345;

    _x = (i+1)*35;

    col = new Color(this["色块"+i])

    col.setRGB(色[i])

    }

    this["色块"+i].onPress = function(){

    _root.颜色 = 色[this.p]

    }

    }

    createEmptyMovieClip("图画",1)

    with(图画){

    setMask(_root.画框)

    onMouseDown = function(){

    draw = true;

    lineStyle(_root.粗度,_root.颜色,100)

    moveTo(_root._xmouse,_root._ymouse)

    }

    onMouseMove = function(){

    if(draw){

    lineTo(_root._xmouse,_root._ymouse)

    }

    updateAfterEvent();

    }

    onMouseUp = function(){

    draw = false;

    }

    }

    //清除按钮

    Clear.onRelease = function(){

    _root.图画.clear();

    }

最新文章