Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Add easing to a rotating 3D object in flash

Community Beginner ,
Jun 28, 2013 Jun 28, 2013

I imported and image sequence of a 3d model in flash, added a script to rotate the model. Can anyone add to the script below to add easing to the object. I want the object to stop slowly when rotated, instead of an abrupt stop.

photos.stop();

var startX:Number;

var startFrame:int;

var changeDistance:int;

var travelDistance:int;

photos.buttonMode = true;

photos.addEventListener(MouseEvent.MOUSE_DOWN, pressHandler);

function pressHandler(evt:MouseEvent):void {

  startX = photos.mouseX;

  startFrame = photos.currentFrame;

  photos.addEventListener(MouseEvent.MOUSE_MOVE, moveHandler);

  stage.addEventListener(MouseEvent.MOUSE_UP, releaseHandler);

}

function releaseHandler(evt:MouseEvent):void {

  photos.removeEventListener(MouseEvent.MOUSE_MOVE, moveHandler);

  stage.removeEventListener(MouseEvent.MOUSE_UP, releaseHandler);

}

function moveHandler(evt:MouseEvent):void {

  changeDistance = Math.round((photos.mouseX - startX) / +10);

  travelDistance = startFrame + changeDistance;

  if (travelDistance > photos.totalFrames) {

  photos.gotoAndStop(travelDistance % photos.totalFrames);

  } else if (travelDistance < 0) {

  photos.gotoAndStop(photos.totalFrames + (travelDistance % photos.totalFrames));

  } else {

  photos.gotoAndStop(travelDistance);

  }

}

TOPICS
ActionScript
840
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 28, 2013 Jun 28, 2013

I imported and image sequence of a 3d model in flash

if you have a 360 degree rotating object that is prerendered resonably detailed (meaning you have like 360 angles) you could simulate the "slowing down" by

simply slowing down the framerate of your movie

this can be done with

stage.addEventListener(Event.ENTER_FRAME, slowDownHandler);

function slowDownHandler(e:Event):void{

  if(stage.framerate>15){

     stage.framerate--;

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 28, 2013 Jun 28, 2013

I'm sorry, can you show where to place it in the script

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 28, 2013 Jun 28, 2013

It depends, show a screenshot of your photos MovieClip timeline on stage, then I might be able to give a hint.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 28, 2013 Jun 28, 2013

Screen shot 2013-06-28 at 10.07.59 AM.pngScreen shot 2013-06-28 at 10.07.59 AM.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jul 01, 2013 Jul 01, 2013
LATEST

currently your movie is running at 24 fps. to get a reasonable "pseudo ease" you will have to adjust maybe between 36fps and 12 fps (this takes experimenting)

so you could make a layer above the layer you are showing in the screenshot and if the timeline is 140 frames add keyframes on frames 1,80,100.

//on 1 you write

stage.FrameRate = 36

//on 80 you write

stage.FrameRate = 24

//on 100 you write

stage.FrameRate = 12

it will take lot of experimenting though, to get it right, don`t await wonders.

After Effects would be my personal choice to precompose this easing effect, Flash is not exactly good at manipulating bitmaps consistently

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines