本文整理汇总了C++中Anim::value方法的典型用法代码示例。如果您正苦于以下问题:C++ Anim::value方法的具体用法?C++ Anim::value怎么用?C++ Anim::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anim
的用法示例。
在下文中一共展示了Anim::value方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseDown
void EasingApp::mouseDown(MouseEvent event) {
end_pos = event.getPos();
timeline().apply(¤t_pos,
end_pos.value(),
1.0f, easeOutInCirc);
}
示例2: touchesBegan
void PhotoBoothApp::touchesBegan( TouchEvent event ){
TouchEvent::Touch touch = event.getTouches().front();
Vec2f cameraButtonTargetPos = Vec2f(mCameraButtonPos.value());
float touchX = touch.getX() / DISPLAY_SCALE;
float touchY = touch.getY() / DISPLAY_SCALE;
switch(mCurrentState) {
case STATE_PREVIEW:
// see if the camera icon has been tapped (touch coordinates are reversed for landscape mode)
cameraButtonTargetPos.x += mCameraButtonTexture.getWidth() / 2.0f;
cameraButtonTargetPos.y += mCameraButtonTexture.getHeight() / 2.0f;
if( cameraButtonTargetPos.distance( Vec2f(touchX, touchY) ) < (mCameraButtonTexture.getWidth() * 2) ) {
mCountDownStartTime = getElapsedSeconds();
mCurrentState = STATE_COUNT_DOWN;
}
break;
case STATE_COUNT_DOWN:
// stub..
break;
case STATE_ACCEPT:
if(touchY > 1280) { // only look for touches near the bottom of the screen.
// just split the screen in half, no need to do precise hit detection for save/cancel buttons..
if(touchX > width / 2){
ip::flipVertical( &mCameraSurface );
cinder::cocoa::SafeUiImage img = cocoa::createUiImage( mCameraSurface );
// Call into objective C to do upload via cocoa
FileSender::sendFile(img);
timeline().apply( &mPreviewTexturePos, Vec2f(0, -height ), 1.0f, EaseInCubic() );
}else{
timeline().apply( &mPreviewTexturePos, Vec2f(0, height ), 1.0f, EaseInBack() );
}
mCurrentState = STATE_PREVIEW;
timeline().apply( &mDarkBgAlpha, 0.0f, 1.0f, EaseInCubic() );
// Hide buttons
timeline().apply( &mDiscardPos, Vec2f(100, height + 100 ), 1.0f, EaseInCubic() );
timeline().apply( &mSavePos, Vec2f(width-700, height + 100 ), 1.0f, EaseInCubic() );
}
break;
}
}
示例3: resetSample
void InstascopeApp::resetSample()
{
// reset sample pos
mSampleSize = randInt(100, 300);
mSamplePt.value().y = randFloat(0, getWindowWidth() - mSampleSize);
mSamplePt.value().x = randFloat(0, getWindowHeight() - mSampleSize);
vec2 newPos;
int count = 0;
// Try to find a good sample location thats within the window's frame.
// Give up if we try and settle after a bunch of times, no big deal.
do {
newPos.x = randFloat(0, getWindowWidth() - mSampleSize/2);
newPos.y = randFloat(0, getWindowHeight() - mSampleSize/2);
count++;
} while(count < 150 && ((mSamplePt.value().x - newPos.x) < 100 || (mSamplePt.value().y - newPos.y) < 100));
timeline().apply(&mSamplePt, newPos, MIRROR_DUR - 1, EaseInOutQuad()).delay(.5);
}
示例4: updateMirrors
void InstascopeApp::updateMirrors( vector<TrianglePiece> *vec )
{
if( ! mMirrorTexture )
return;
vec2 mSamplePt1( -0.5, -(sin(M_PI/3)/3) );
vec2 mSamplePt2( mSamplePt1.x + 1, mSamplePt1.y);
vec2 mSamplePt3( mSamplePt1.x + (cos(M_PI/3)), mSamplePt1.y + (sin(M_PI/3)));
mat3 mtrx( 1.0f );
mtrx = glm::translate( mtrx, mSamplePt.value() );
mtrx = glm::scale( mtrx, vec2( mSampleSize ) );
mtrx = glm::rotate( mtrx, float((getElapsedFrames()*4)/2*M_PI) );
mSamplePt1 = vec2( mtrx * vec3( mSamplePt1, 1.0 ) );
mSamplePt2 = vec2( mtrx * vec3( mSamplePt2, 1.0 ) );
mSamplePt3 = vec2( mtrx * vec3( mSamplePt3, 1.0 ) );
mSamplePt1 /= mMirrorTexture->getSize();
mSamplePt2 /= mMirrorTexture->getSize();
mSamplePt3 /= mMirrorTexture->getSize();
// loop through all the pieces and pass along the current texture and it's coordinates
int outCount = 0;
int inCount = 0;
for( int i = 0; i < vec->size(); i++ ) {
(*vec)[i].update( mMirrorTexture, mSamplePt1, mSamplePt2, mSamplePt3 );
if( (*vec)[i].isOut() ) outCount++;
if( (*vec)[i].isIn() ) inCount++;
}
// if all are out, then make a new mirror grid
if( outCount > 0 && outCount == mTriPieces.size() ) {
mirrorOut();
}
// if all the pieces are in
if( inCount > 0 && inCount == mTriPieces.size() && ! mPiecesIn ) {
mPiecesIn = true;
mirrorIn();
}
}
示例5: draw
void PhotoBoothApp::draw()
{
gl::enableAlphaBlending();
gl::clear();
gl::color(1, 1, 1, 1);
glDepthMask( GL_FALSE );
// Set up the view for landscape mode.
gl::setMatricesWindow(width * DISPLAY_SCALE, height * DISPLAY_SCALE);
gl::scale(DISPLAY_SCALE, DISPLAY_SCALE);
// draw the live camera preview
if( mCameraTexture ) {
// flip the texture vertically
mCameraTexture.setFlipped(false);
// draw the texture mirrored.
gl::draw( mCameraSurface, Rectf(width, 0, 0, height) );
}
// draw "idle" stuff (text and images overlayed on the live camera preview)
if(mCurrentState == STATE_PREVIEW){
gl::color(1, 1, 1, 0.75f);
gl::draw(mLightBg, Rectf(0, 0, width, height));
gl::color(1, 1, 1, 1);
gl::draw(mIntroTexture, Rectf(0,0,width, height));
gl::draw(mCameraButtonTexture, mCameraButtonPos.value() - Vec2f(0, abs( sin(getElapsedSeconds() * 3) * 30)));
//gl::draw(mCameraButtonTexture, Rectf(mCameraButtonPos.value().x,mCameraButtonPos.value().y, mCameraButtonTexture.getWidth() * 0.5 + mCameraButtonPos.value().x, mCameraButtonTexture.getHeight() * 0.5 + mCameraButtonPos.value().y) );// mCameraButtonPos.value() );
}
// Draw the preview image with dark background.
if(mPreviewTexture){
// draw background image and prompt text.
if(mDarkBgAlpha > 0){
gl::color(1, 1, 1, mDarkBgAlpha);
gl::draw(mDarkBg, Vec2f::zero());
gl::draw(mConfirmMessage, Vec2f(width/2 - mConfirmMessage.getWidth() / 2, 125 - mConfirmMessage.getHeight() / 2));
}
float aspect = mPreviewTexture.getAspectRatio();
float imageHeight = height - 500; // margins are keyed off of hard-coded height, this is not very multi-resolution friendly.
float imageWidth = imageHeight * aspect;
float marginX = (width - imageWidth) / 2;
float marginY = (height - imageHeight) / 2;
gl::draw(mPreviewTexture, Rectf(marginX, marginY, width - marginX, height - marginY) + mPreviewTexturePos);
// Draw semi-transparent pillar boxes to show how the sqare version of the image will look.
if(mCurrentState == STATE_ACCEPT) {
float pillarWidth = (imageWidth - imageHeight) / 2;
gl::color(0, 0, 0, 0.35f);
gl::drawSolidRect( Rectf( marginX, height - marginY, pillarWidth + marginX, marginY ) );
gl::drawSolidRect( Rectf( width - marginX - pillarWidth, height - marginY, width - marginX, marginY ) );
}
}
// draw the "flash"
if(mCurrentState == STATE_ACCEPT){
gl::color(1, 1, 1, mCameraFlash);
gl::drawSolidRect( Rectf(0, 0, width, height));
}
// draw count-down timer
if(mCurrentState == STATE_COUNT_DOWN){
// draw dark circle background
Vec2f centerPos = Vec2f(width / 2 - mNumberBg.getWidth() / 2, height / 2 - mNumberBg.getHeight() / 2);
gl::draw( mNumberBg, centerPos);
// background ring that "fills up" for each second.
gl::draw(mNumberProgress, Area(0, mNumberProgress.getHeight() * mCountDownFractional, mNumberProgress.getWidth(), mNumberProgress.getHeight()), Rectf(centerPos.x,centerPos.y+mNumberProgress.getHeight() * mCountDownFractional, mNumberBg.getWidth()+centerPos.x, centerPos.y+mNumberBg.getHeight()));
// Draw number.
gl::enableAdditiveBlending();
gl::draw( mNumberTextures[mCountDownNumber], centerPos);
}
gl::color(1, 1, 1, 1);
gl::draw(mSaveTexture, mSavePos);
gl::draw(mDiscardTexture, mDiscardPos);
}