小编Ash*_*ron的帖子

iOS Paper折叠(折纸/手风琴)效果动画,带手动控制

我正在寻找有关如何在我的iOS项目中实现流行的"纸张折叠/折纸"效果的提示.

我知道的项目如:https: //github.com/xyfeng/XYOrigami 但他们只提供'动画'效果,没有手动控制开场动画.

我一直在努力剖析那个项目并想出我所追求的目标.

更确切地说,我正在研究如何实现此处显示的效果:http://vimeo.com/41495357其中折叠动画不仅仅是动画打开,而是用户控制开始折叠.

任何帮助将非常感谢,提前感谢!

编辑:

好的,这里有一些示例代码可以更好地说明我正在努力解决的问题:

此方法触发折纸效果动画:

- (void)showOrigamiTransitionWith:(UIView *)view 
                NumberOfFolds:(NSInteger)folds 
                     Duration:(CGFloat)duration
                    Direction:(XYOrigamiDirection)direction
                   completion:(void (^)(BOOL finished))completion
{

if (XY_Origami_Current_State != XYOrigamiTransitionStateIdle) {
    return;
}
XY_Origami_Current_State = XYOrigamiTransitionStateUpdate;

//add view as parent subview
if (![view superview]) {
    [[self superview] insertSubview:view belowSubview:self];
}


//set frame
CGRect selfFrame = self.frame;
CGPoint anchorPoint;
if (direction == XYOrigamiDirectionFromRight) {

    selfFrame.origin.x = self.frame.origin.x - view.bounds.size.width;

    view.frame = CGRectMake(self.frame.origin.x+self.frame.size.width-view.frame.size.width, self.frame.origin.y, view.frame.size.width, view.frame.size.height);

    anchorPoint = CGPointMake(1, 0.5);
}
else …
Run Code Online (Sandbox Code Playgroud)

iphone animation accordion fold ios

8
推荐指数
2
解决办法
2万
查看次数

OpenGL纹理贴图坐标

我需要能够拉伸我在整个2d或3d(面部)形状上导入的图像纹理.它只会在形状的右上角渲染,并且重复 - 如果我启用GL_REPEAT,或者如果我启用GL_CLAMP,图像将从突出到边缘的边伸展.

这是我的代码:

#include "stdafx.h"
#include "glut.h"
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>



GLuint texture;
float xRotation = 0.0f;




void drawScene1 (void) {
    //glRotatef(xRotation,0.0f,1.0f,0.0f);
    glBindTexture(GL_TEXTURE_2D, texture);
    //glutSolidCube(1.0f);

    glBegin(GL_POLYGON);
        glTexCoord2d(0,1);
        glVertex2d(-1.5,-1.5);

        glTexCoord2d(1,1);
        glVertex2d(1.0,-2.0);

        glTexCoord2d(1,0);
        glVertex2d(+1.5,+1.5);

        glTexCoord2d(0,0);
        glVertex2d(-1.5,+1.5);
    glEnd();
}




void FreeTexture(GLuint texture) {
  glDeleteTextures(1, &texture);
}



GLuint LoadTexture(const char * filename, int width, int height) {

    GLuint texture;
    unsigned char * data;
    FILE * file;

    file = fopen(filename, "rb");
    if ( file == NULL ) return 0;
    data = (unsigned …
Run Code Online (Sandbox Code Playgroud)

opengl textures

0
推荐指数
1
解决办法
1042
查看次数

标签 统计

accordion ×1

animation ×1

fold ×1

ios ×1

iphone ×1

opengl ×1

textures ×1