Files
2025-12-15 22:10:55 +08:00

123 lines
4.0 KiB
C++

/***********************************************************************************************************************
*
* Copyright (c) 2010 - 2022 by Tech Soft 3D, Inc.
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
* employees of Tech Soft 3D, Inc. is granted only under a written non-disclosure agreement, expressly prescribing the
* scope and manner of such use.
*
***********************************************************************************************************************/
/**
\file AnimDefStep6.cpp
Animation for Step 6
***********************************************************************************************************************/
// Do not define INITIALIZE_A3D_API here. It should be only included once in a project.
#include "AnimDef.hpp"
//######################################################################################################################
/*
Zoom in to washer
Pause 1 second.
Flash the color of the front casing from original color to yellow three times over one second.
Pause 0.5 seconds
and then remove the washer and have it disappear.
Now bring in a new washer which is a different color.
*/
A3DStatus BuildAnimationStep6(A3DPDFAnimation **ppAnim,
double dStepInitTimeOffset,
double& dStepTimeDuration)
{
A3DStatus iRet = A3D_SUCCESS;
// ANIMATION = set of MOTIONS
const int INBMOTIONS = 20;
A3DPDFAnimMotion** ppMotion;
ppMotion = (A3DPDFAnimMotion**) malloc(INBMOTIONS * A3DUns32(sizeof(A3DPDFAnimMotion*)));
int idxMotion = 0;
double dInitTimeOffset = dStepInitTimeOffset;
double dTimeDuration;
// MOTIONS to specify init state
CreateMotionsInitState(ppMotion, idxMotion, 6,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION CAMERA
CreateMotionCameraInit(ppMotion, idxMotion,
407.025665, 316.211060, 244.481506,
17.669889, 10.242504, -62.340408,
-0.390901, -0.354405, 0.849471,
10, kA3DPDFOrthographicMode, 1.0/(2*164),
121.631744, 65.543808, -3.716970,
30.948513, 27.898954, -16.392185,
-0.099281, -0.094375, 0.990579,
10, kA3DPDFOrthographicMode, 1.0/(2*28),
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 1
// Flash the color of the washer from original color to yellow three times over one second.
CreateMotionFlash(ppMotion, idxMotion,
ppTargetsWasher, idxTargetsWasher,
1, 1, 0, // color init
1, 0, 0, // color blink
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 2
// Pause 0.5 seconds and then remove the washer
// pause 0.5 seconds
dInitTimeOffset += PAUSEDEMISEC;
CreateMotionMoveAndHide(ppMotion, idxMotion,
ppTargetsWasher, idxTargetsWasher,
0.0, 0.0, 0.0, // init pos
0.0, -80.0, 0.0, // translation to apply
1,1,0, // color init
true, //bHide
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 3
// Now bring in a new washer which is a different color.
// pause 0.5 seconds
dInitTimeOffset += PAUSE1SEC;
CreateMotionMoveAndHide(ppMotion, idxMotion,
ppTargetsWasher, idxTargetsWasher,
0.0, -80.0, 0.0, // init pos
0.0, +80.0, 0.0, // translation to apply
1,0,1, // color init
false, //bHide
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
dStepTimeDuration = dInitTimeOffset - dStepInitTimeOffset;
// --- ANIMATION CREATION
A3DPDFAnimationData sAnimationData;
A3D_INITIALIZE_DATA(A3DPDFAnimationData, sAnimationData);
sAnimationData.m_pcName = const_cast<A3DUTF8Char*>("step6");
sAnimationData.m_iFramesPerSecond = 20;
sAnimationData.m_iNumAnimationMotions = idxMotion;
sAnimationData.m_ppAnimationMotions = ppMotion;
iRet = A3DPDFAnimationCreate(&sAnimationData, ppAnim);
return iRet;
}