Hello there,
Im working on a flash project, and i need a little optimalisation.
First, the example: http://www.studiosteen.nl/clients/windsor/#/baden and click on a thumbnail (sorry, second deeplink for the fullscreen image doesnt work yet :))
The image should move on MouseMove, that is working. But if you check your CPU , its going WILD ! sometimes even up to 140%! Thats not what i want of course..
This is the function in the full image class:
private function onMouseMove(e:MouseEvent):void {
var rapW:Number = (stage.stageWidth/2)/((_photo.width-stage.stageWidth)/2);
var rapH:Number = (stage.stageHeight/2)/((_photo.height-stage.stageHeight)/2);
var speed:Number = ConfigManager.SPEED*2.5;
if (_photo.width>stage.stageWidth) {
TweenLite.to(_photo, speed, {x:-mouseX/rapW, ease:Quart.easeOut});
}
if (_photo.height>stage.stageHeight) {
TweenLite.to(_photo, speed, {y:-mouseY/rapH, ease:Quart.easeOut});
}
}
Maybe some of you has some good tips for me ?
That’s because you’re creating a TweenLite instance for each cicle. With around 30 cicles a sec it’s normal the cpu consumption will be high. Why don’t you use something like this:
if(_photo.height>stage.stageHeight){
moveToY = -(stage.mouseY/stage.stageHeight)*(_photo.height-stage.stageHeight);
_photo.y += (moveToY - _photo.y)/easeAmount;
}
It’ll ease the motion without the use of tweenLite. Do the same for X. Just coded this here in a min, don’t be surprised if something isn’t right 
Oh, and my cpu only got to 21% with your file 
21% with my code? or your code?
hmm… weird stuff! But thanks
gonna try yours tomorrow! Hope it helps
Thanks!
21 with your code. Give it a try with mine..
