Files
Hoops_Exchange/publish/publishsource/AnimWorkinstruction/AnimDefStep2.cpp
2025-12-15 22:10:55 +08:00

134 lines
4.5 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 AnimDefStep2.cpp
Animation for Step 2
***********************************************************************************************************************/
// Do not define INITIALIZE_A3D_API here. It should be only included once in a project.
#include "AnimDef.hpp"
//######################################################################################################################
/*
Zoom to back of engine.
Pause 1seconds.
Flash the color of one screw to yellow three times over one second.
Pause 0.5 seconds
and then remove the screw out backwards.
When it is out make it disappear by turning it fully transparent.
Pause 1 second
now repeat flash three times
and remove for the other three screws as we did with the first screw.
*/
A3DStatus BuildAnimationStep2(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, 2,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION CAMERA
CreateMotionCameraInit(ppMotion, idxMotion,
240.637375, -170.123276, 153.468277,
42.014103, 28.500000, -45.155003,
-0.408250, 0.408250, 0.816500,
10, kA3DPDFOrthographicMode, 1.0/(2*137),
-1153.480469, -337.387329, 307.219879,
47.379890, 29.873722, -48.658806,
0.254603, 0.099596, 0.961904,
10, kA3DPDFOrthographicMode, 1.0/(2*160),
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 1
// Flash the color of one screw to yellow three times over one second.
CreateMotionFlash(ppMotion, idxMotion,
ppTargetsScrew1, idxTargetsScrew1,
1, 0, 0, // color init
1, 1, 0, // color blink
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 2
// remove the screw out backwards. When it is out make it disappear by turning it fully transparent.
CreateMotionMoveAndHide(ppMotion, idxMotion,
ppTargetsScrew1, idxTargetsScrew1,
0.0, 0.0, 0.0, // init pos
-80.0, 0.0, 0.0, // translation to apply
1, 0, 0, // color init
true, //bHide
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 3
// repeat with other screws
// Flash the color to yellow three times over one second.
CreateMotionFlash(ppMotion, idxMotion,
ppTargetsScrew2To4, idxTargetsScrew2To4,
1, 0, 0, // color init
1, 1, 0, // color blink
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
// MOTION 4
// repeat with other screws
// remove the screw out backwards. When it is out make it disappear by turning it fully transparent.
CreateMotionMoveAndHide(ppMotion, idxMotion,
ppTargetsScrew2To4, idxTargetsScrew2To4,
0.0, 0.0, 0.0, // init pos
-80.0, 0.0, 0.0, // translation to apply
1, 0, 0, // color init
true, //bHide
kA3DPDFRenderingSolid,
dInitTimeOffset,
dTimeDuration);
dInitTimeOffset += dTimeDuration;
dStepTimeDuration = dInitTimeOffset - dStepInitTimeOffset;
// --- ANIMATION CREATION
A3DPDFAnimationData sAnimationData;
A3D_INITIALIZE_DATA(A3DPDFAnimationData, sAnimationData);
sAnimationData.m_pcName = const_cast<A3DUTF8Char*>("step2");
sAnimationData.m_iFramesPerSecond = 20;
sAnimationData.m_iNumAnimationMotions = idxMotion;
sAnimationData.m_ppAnimationMotions = ppMotion;
iRet = A3DPDFAnimationCreate(&sAnimationData, ppAnim);
return iRet;
}