Announcement

Collapse
No announcement yet.

masking and alpha clarification pls?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    masking and alpha clarification pls?

    Hello, would it be possible to clarify the limitations of masking and the setMask features used on gfx movies?

    ive tried using a layer mask, and it seems to work in *some* situations, setMask doesnt seem to work at all...

    #2
    masks use antialiasing which isnt yet supported in scaleform but *could* be a furture updates, im hoping it is as it would be very handy.

    Comment


      #3
      so i just *cant mask anything* ?

      Comment


        #4
        prety much. im working on it today but you can kind of get around it by using butmap fill layers. masking definately doesnt work as antialiasing isnt in scaleform yet.

        as i said im gonna work on it today and ill get back to you on here when i figure out if this fill layer things anything good.

        http://www.kirupa.com/developer/mx2004/fills4.htm

        it doesnt seems to quite do what i want. i have an oddly shaped healthbar. its basically a rectangle but with a curve on it and this fill doesnt work, the masking does but not in udk.

        Comment


          #5
          ive found all sorts of fanciness one can do with drawing vector geometry to keep me happy until they sort out masking. the prospect of no masking at all frightens me a little bit. this bitmapfill thing seems to be a bit of a hack.

          Comment


            #6
            yeah i was hoping it might work similarly but it is a hack and not a good one. wont work for this anyway, it does let you create static shapes tho.

            does the vector geometry let you makesuch things as curved health bars?

            Comment


              #7
              indeed it does, heres a couple of intresting bits ive played with, fling these in a scene

              Code:
              // r1 = radius of outer circle
              // r2 = radius of inner circle (cutout)
              // x, y = center of donut
              // This creates a donut shape (circle with a cutout circle)
              MovieClip.prototype.drawDonut1 = function(r1, r2, x, y,inc) {
              	var TO_RADIANS:Number = Math.PI/180;
              	this.moveTo(0,0);
              	this.lineTo(r1,0);
              
              	// draw the 30-degree segments
              	var a:Number = 0.268;// tan(15)
              	for (var i = 0; i<inc; i++) {
              		var endx = r1*Math.cos((i+1)*5*TO_RADIANS);
              		var endy = r1*Math.sin((i+1)*5*TO_RADIANS);
              		var ax = endx+r1*a*Math.cos(((i+1)*5-90)*TO_RADIANS);
              		var ay = endy+r1*a*Math.sin(((i+1)*5-90)*TO_RADIANS);
              		this.curveTo(ax,ay,endx,endy);
              	}
              	// cut out middle (draw another circle before endFill applied)
              	this.moveTo(0,0);
              	this.lineTo(r2,0);
              
              	for (var i = 0; i<inc; i++) {
              		var endx = r2*Math.cos((i+1)*5*TO_RADIANS);
              		var endy = r2*Math.sin((i+1)*5*TO_RADIANS);
              		var ax = endx+r2*a*Math.cos(((i+1)*5-90)*TO_RADIANS);
              		var ay = endy+r2*a*Math.sin(((i+1)*5-90)*TO_RADIANS);
              		this.curveTo(ax,ay,endx,endy);
              	}
              
              	this._x = x;
              	this._y = y;
              };
              
              
              
              
              
              
              
              var step = 1;
              sinarray1 = Array();
              
              
              
              function drawwave(wwidth, waveclip, wstep, wcolor, wlayer):Void {
              	var i = 0;
              
              	while (i<100) {
              		var s = Math.sin((wstep/100)/1);
              		var v = Math.sin(i/s);
              		sinarray1[i] = v;
              		i++;
              	}
              	mc = this.createEmptyMovieClip(waveclip, wlayer);
              	with (mc) {
              
              		//lineStyle(0, 0x0000FF, 100); 
              		lineStyle(wwidth,wcolor,50,true,"none","round","miter",1);
              
              		beginFill(wcolor);
              		moveTo(0,0);
              
              		var i = 0;
              		while (i<sinarray1.length) {
              			mody = (60);
              			modx = 1024/(sinarray1.length-1);
              
              			xea = i*modx;
              			yea = sinarray1[i]*mody;
              			xec = (i+1)*modx;
              			yec = sinarray1[(i+1)]*mody;
              
              
              			cv = Array(xea, yea, xea, yea);
              			curveTo(cv[0],cv[1],cv[2],cv[3]);
              
              
              			endFill();
              			i++;
              
              		}
              
              
              		_x = 0;
              		_y = 256;
              
              	}
              
              }
              
              
              function rn() {
              	n = random(100);
              	return (n);
              }

              and on another frame,

              Code:
              var step;
              step = step+1;
              //this.drawwave(10,"wave1",1,0x666666,1);
              this.drawwave(3,"wave2",(_xmouse/1024)+5,0x990000,2);
              removeMovieClip(d1);
              createEmptyMovieClip("d1",100);
              var colors:Array = [0, 0x000000, 0xffffff];
              d1.beginFill(colors[1]);
              d1.drawDonut1(64,30,100,94,step%60);
              d1.endFill();
              
              this.gotoAndPlay(4);

              just some cheapy copypaste maths i found for drawing a curved bar, theres a ton of flash code about on the web for simple stuff like this.
              (the sine wave stuff is an experiment for a hacking minigame where you synchronise sine waves, but i gave up cos it just gave me a massive headache to play with)


              im an actionscript noob and my maths is appaling (if you can figure how to fix the lil glitch in the donut btw you're one up on me) but i have long experience on oldstyle macromedia shockwave lingo, so a lot of my knowledge is salvageable, but im lacking a lot of the basics. i know how to draw shapes for example, but i dont know if theres a better way of updating them than to just create a new clip all the time

              Comment

              Working...
              X