Não deu pra não postar, muito bom o vídeo!
O original...
O original...
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
width="400"
height="400"
applicationComplete="applicationCompleteHandler()"
viewSourceURL="srcview/index.html">
<fx:Script>
<![CDATA[
import com.greensock.TimelineMax;
import com.greensock.TweenMax;
import com.greensock.easing.Bounce;
import com.greensock.easing.Elastic;
[Bindable]
private var _timelineMax:TimelineMax;
[Bindable]
public var pathY:Number = 10;
[Bindable]
public var pathWidth:Number = 200;
[Bindable]
public var pathHeight:Number = pathWidth + pathY;
private function applicationCompleteHandler():void
{
_timelineMax = new TimelineMax();
_timelineMax.addChild( new TweenMax( this, 12, { pathY:height - myPath.height, ease:Elastic.easeOut } ) );
_timelineMax.addChild( new TweenMax( this, 2, { pathHeight:height, ease:Bounce.easeOut } ) );
_timelineMax.pause();
}
private function playClickHandler():void
{
_timelineMax.play();
}
protected function stopClickHandler():void
{
_timelineMax.currentTime = 0;
_timelineMax.stop();
}
protected function labelClickHandler():void
{
navigateToURL( new URLRequest( 'http://www.idemax.net/' ), '_blank' );
}
]]>
</fx:Script>
<s:Rect width="100%"
height="100%">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="#ffffff" />
<s:GradientEntry color="#cccccc" />
</s:LinearGradient>
</s:fill>
</s:Rect>
<mx:Image horizontalCenter="0"
verticalCenter="0"
source="@Embed('/assets/images/idemax.jpg')">
<mx:filters>
<mx:BlurFilter quality="3" />
</mx:filters>
</mx:Image>
<s:VGroup top="10"
left="10">
<s:Button label="play"
click="playClickHandler()" />
<s:Button label="stop"
click="stopClickHandler()" />
</s:VGroup>
<s:Path id="myPath"
data="m 0 {pathY}
q {pathWidth/2} {-((pathHeight-pathY)-pathWidth)} {pathWidth} 0
Q {pathWidth+((pathHeight-pathY)-pathWidth)} {(pathHeight-(pathWidth/2))-((pathHeight-pathY)-pathWidth)} {pathWidth} {pathHeight}
h {-pathWidth}
Q {-((pathHeight-pathY)-pathWidth)} {(pathHeight-(pathWidth/2))-((pathHeight-pathY)-pathWidth)} 0 {pathY}
z"
horizontalCenter="0">
<s:stroke>
<s:SolidColorStroke color="#333333"
weight="1" />
</s:stroke>
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="#a8d848" />
<s:GradientEntry color="#63802a"
alpha=".5" />
</s:LinearGradient>
</s:fill>
<s:filters>
<s:DropShadowFilter angle="90"
distance="20"
quality="3"
blurX="20"
blurY="20" />
</s:filters>
</s:Path>
<s:Label right="10"
bottom="10"
text="www.idemax.net"
fontWeight="bold"
alpha=".25"
click="labelClickHandler()"
buttonMode="true" />
</s:Application>
public function Main()
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveHandler);
}
private function onMouseMoveHandler($event:MouseEvent):void
{
graphics.clear();
rotateEye(eye1);
rotateEye(eye2);
$event.updateAfterEvent();
}
var catAdj:Number = mouseX - $eye.x;
var catOp:Number = mouseY - $eye.y;
var hipot:Number = Math.sqrt((catAdj * catAdj) + (catOp * catOp));
var radians:Number = Math.asin(catOp / hipot);
var degree:Number = radians * (180 / Math.PI);
if (catAdj >= 0)
{
$eye.rotation = degree;
}
else
{
$eye.rotation = 180 - degree;
}
log.text = 'catAdj: ' + catAdj;
log.appendText('\ncatOp: ' + catOp);
log.appendText('\nhipot: ' + hipot);
log.appendText('\nradians: ' + radians);
log.appendText('\ndegree: ' + degree);
graphics.lineStyle(1, 0xff0000);
graphics.moveTo($eye.x, $eye.y);
graphics.lineTo(mouseX, mouseY);
graphics.lineStyle(1, 0xcccccc);
graphics.lineTo(mouseX, $eye.y);
graphics.lineTo($eye.x, $eye.y);
private function rotateEye($eye:MovieClip):void
{
var catAdj:Number = mouseX - $eye.x;
var catOp:Number = mouseY - $eye.y;
var hipot:Number = Math.sqrt((catAdj * catAdj) + (catOp * catOp));
var radians:Number = Math.asin(catOp / hipot);
var degree:Number = radians * (180 / Math.PI);
if (catAdj >= 0)
{
$eye.rotation = degree;
}
else
{
$eye.rotation = 180 - degree;
}
log.text = 'catAdj: ' + catAdj;
log.appendText('\ncatOp: ' + catOp);
log.appendText('\nhipot: ' + hipot);
log.appendText('\nradians: ' + radians);
log.appendText('\ndegree: ' + degree);
graphics.lineStyle(1, 0xff0000);
graphics.moveTo($eye.x, $eye.y);
graphics.lineTo(mouseX, mouseY);
graphics.lineStyle(1, 0xcccccc);
graphics.lineTo(mouseX, $eye.y);
graphics.lineTo($eye.x, $eye.y);
}
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextField;
/**
* ...
* @author www.idemax.net
*/
public class Main extends MovieClip
{
public var eye1:MovieClip;
public var eye2:MovieClip;
public var log:TextField;
public function Main()
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveHandler);
}
private function onMouseMoveHandler($event:MouseEvent):void
{
graphics.clear();
rotateEye(eye1);
rotateEye(eye2);
$event.updateAfterEvent();
}
private function rotateEye($eye:MovieClip):void
{
var catAdj:Number = mouseX - $eye.x;
var catOp:Number = mouseY - $eye.y;
var hipot:Number = Math.sqrt((catAdj * catAdj) + (catOp * catOp));
var radians:Number = Math.asin(catOp / hipot);
var degree:Number = radians * (180 / Math.PI);
if (catAdj >= 0)
{
$eye.rotation = degree;
}
else
{
$eye.rotation = 180 - degree;
}
log.text = 'catAdj: ' + catAdj;
log.appendText('\ncatOp: ' + catOp);
log.appendText('\nhipot: ' + hipot);
log.appendText('\nradians: ' + radians);
log.appendText('\ndegree: ' + degree);
graphics.lineStyle(1, 0xff0000);
graphics.moveTo($eye.x, $eye.y);
graphics.lineTo(mouseX, mouseY);
graphics.lineStyle(1, 0xcccccc);
graphics.lineTo(mouseX, $eye.y);
graphics.lineTo($eye.x, $eye.y);
}
}
}
package
{
import fl.controls.Slider;
import fl.events.SliderEvent;
import flash.display.MovieClip;
/**
* ...
* @author www.idemax.net
*/
public class Main extends MovieClip
{
public var avatar:MovieClip;
public var xAxis:Slider;
public var yAxis:Slider;
public var zAxis:Slider;
public function Main()
{
xAxis.addEventListener(SliderEvent.CHANGE, onSliderChange);
yAxis.addEventListener(SliderEvent.CHANGE, onSliderChange);
zAxis.addEventListener(SliderEvent.CHANGE, onSliderChange);
}
private function onSliderChange(event:SliderEvent):void
{
var slider:Slider = event.target as Slider;
switch(slider)
{
case xAxis:
avatar.rotationX = slider.value;
break;
case yAxis:
avatar.rotationY = slider.value;
break;
case zAxis:
avatar.rotationZ = slider.value;
break;
}
}
}
}