Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I whipped up some code for you<br> Any questions just ask.</p> <pre><code>import flash.geom.Matrix; var temp_matrix = new Matrix(); var square:Sprite = new Sprite(); addChild(square); square.graphics.lineStyle(3,0x000000); square.graphics.drawRect(0,0,200,100); square.graphics.endFill(); var angle:Number = -10; // the angle of degrees temp_matrix.b = Math.PI * 2 * angle / 360;// y skew //temp_matrix.c = Math.PI * 2 * angle / 360;// x skew var sourceMatrix:Matrix = square.transform.matrix;// get existing matrix sourceMatrix.concat(temp_matrix); // apply skew to existing matrix square.transform.matrix = temp_matrix;// assign the new skew square.x = 100 square.y = 100 </code></pre> <p>[SECOND ROUND]</p> <pre><code>var trapezium:Sprite = new Sprite(); addChild(trapezium); trapezium.x = 100; trapezium.y = 100; var dir:Boolean = true; var side:Boolean = true; var angle:Number = 0; // the angle of degrees var w:Number = 300; var h:Number = 80; var timer:Timer = new Timer(16); timer.addEventListener( TimerEvent.TIMER, tick ); timer.start(); function tick(e:TimerEvent):void{ var radians:Number = Math.PI/180*angle; trapezium.graphics.clear(); trapezium.graphics.beginFill(0x000000) if( side){ // long side is right side trapezium.graphics.lineTo(w,0); trapezium.graphics.lineTo(w,radians*w+h); trapezium.graphics.lineTo(0,h); trapezium.graphics.lineTo(0,0); }else{ trapezium.graphics.lineTo(w,0); trapezium.graphics.lineTo(w,h); trapezium.graphics.lineTo(0,radians*w+h); trapezium.graphics.lineTo(0,0); } trapezium.graphics.endFill(); if(angle&gt;=10){ dir = false; } if(angle&lt;=0){ dir = true; } if(dir){ angle = angle+.2; }else{ angle = angle-.2; } if( Math.floor(angle*10) &lt;= 0 ){ side = !side; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload