text 翻转runes.pde
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 翻转runes.pde相关的知识,希望对你有一定的参考价值。
PImage img1, img2, img3, img4, img5, img6, img7, img8, img;
float i = 0;
static final color BG = -4;
void setup()
{
size(1000,1000,P3D);
img1 = loadImage("assembly (1).png");
img2 = loadImage("assembly (2).png");
img3 = loadImage("assembly (3).png");
img4 = loadImage("assembly (4).png");
img5 = loadImage("assembly (5).png");
img6 = loadImage("assembly (6).png");
img7 = loadImage("assembly (7).png");
img8 = loadImage("assembly (8).png");
int picheight = 300,picwidth = 300;
img1.resize(picheight, picwidth);
img2.resize(picheight, picwidth);
img3.resize(picheight, picwidth);
img4.resize(picheight, picwidth);
img5.resize(picheight, picwidth);
img6.resize(picheight, picwidth);
img7.resize(picheight, picwidth);
img8.resize(picheight, picwidth);
}
void draw(){
background(BG);
if (frameCount <= 5){
img = img1;
} else if (frameCount <= 13){
img = img2;
} else if (frameCount <= 21){
img = img3;
} else if (frameCount <= 29){
img = img4;
} else if (frameCount <= 37){
img = img5;
} else if (frameCount <= 45){
img = img6;
} else if (frameCount <= 53){
img = img7;
} else if (frameCount <= 61){
img = img8;
} else if (frameCount <= 77){
img = img1;
}
pushMatrix();
// Move the coordinate system to the center of the screen
translate(width/2.0, height/2.0);
// Rotate the coordinate system a bit more each frame
if (frameCount > 2) {
rotateY(i);
}
// Draw the image in the center
image(img,-img.width/2.0, -img.height/2.0);
popMatrix();
// saveFrame("frame####");
saveTransparentCanvas(BG, "img");
i = i+(PI/8);
}
void saveTransparentCanvas(final color bg, final String name) {
final PImage canvas = get(0,0,height,width);
canvas.format = ARGB;
final color p[] = canvas.pixels, bgt = bg & ~#000000;
for (int i = 0; i != p.length; ++i) if (p[i] == bg) p[i] = bgt;
canvas.updatePixels();
canvas.save("Frame"+frameCount+".png");
}
以上是关于text 翻转runes.pde的主要内容,如果未能解决你的问题,请参考以下文章
HDOJ/HDU 1062 Text Reverse(字符串翻转~)
text 使用SCSS翻转卡片。我的CodePen:https://codepen.io/GerdSuhr/pen/xzEMBg;
图像翻转效果和图像下方的文字
JS 实现兼容IE图片向左或向右翻转
JavaScript图片翻转
自由选择翻转和缩放功能