- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试查找可用于创建涂抹/液化效果的信息或示例,该效果可以连续动画回到原始状态。
最初我在考虑使用 three.js 或 pixi.js 渲染一些文本,然后使用鼠标事件和光线转换将网格拖出位置,我发现最接近的是这个。
https://codepen.io/shshaw/pen/qqVgbg
let renderer = PIXI.autoDetectRenderer(window.innerWidth,
window.innerHeight, { transparent: true });
我认为理想情况下,我会将文本渲染为图像,然后将涂抹效果应用于像素,然后它们会慢慢恢复到原始状态。类似这样。
http://www.duhaihang.com/#/work/
我想我可能需要使用自定义 GLSL 着色器和某种缓冲区来保存构成图像的像素的原始状态和当前状态。
如有任何帮助或指导,我们将不胜感激。
最佳答案
两者看起来都比较简单。
第一个,就像您提到的那样,您制作了一个绘制平面的顶点网格(网格)。当您四处拖动鼠标时,您将面纹理映射到平面,为鼠标接触的每个顶点添加位移。随着时间的推移,将位移重置为 0(如位移量为 0)
这是一个示例:它只是将单个顶点置换一个随机量,而不是更可预测的量。最后,我只是节省了位移应该淡出的时间,然后在着色器中我做了一个简单的线性 lerp(可以使用更高级的 lerp 来实现反弹或其他东西)。这几乎就是着色器中发生的所有事情。
const m4 = twgl.m4;
const gl = document.querySelector("canvas").getContext("webgl");
const vs = `
attribute vec4 position;
attribute vec3 displacement;
uniform mat4 u_matrix;
uniform float u_time;
uniform float u_timeToGoBack;
varying vec2 v_texcoord;
void main() {
// because position goes -1 <-> 1 we can just use
// it for texture coords
v_texcoord = position.xy * .5 + .5;
// displacement.z is the time at which it should be undisplaced
float displaceTime = displacement.z - u_time;
float lerp = clamp(displaceTime / u_timeToGoBack, 0., 1.);
vec2 displace = displacement.xy * lerp;
gl_Position = u_matrix * (position + vec4(displace, 0, 0));
}
`;
const fs = `
precision mediump float;
uniform sampler2D texture;
varying vec2 v_texcoord;
void main() {
gl_FragColor = texture2D(texture, v_texcoord);
}
`;
const programInfo = twgl.createProgramInfo(gl, [vs, fs]);
// create a grid of points in a -1 to +1 quad
const positions = [];
const displacements = [];
const indices = [];
const res = 100;
for (var y = 0; y < res; ++y) {
var v = (y / (res - 1)) * 2 - 1;
for (var x = 0; x < res; ++x) {
var u = (x / (res - 1)) * 2 - 1;
positions.push(u, v);
displacements.push(0, 0, 0);
}
}
for (var y = 0; y < res - 1; ++y) {
var off0 = (y + 0) * res;
var off1 = (y + 1) * res;
for (var x = 0; x < res - 1; ++x) {
indices.push(
off0 + x + 0, off0 + x + 1, off1 + x + 0,
off1 + x + 0, off0 + x + 1, off1 + x + 1
);
}
}
// create buffers and fills them in.
// (calls gl.createBuffer and gl.bufferData for each array)
const bufferInfo = twgl.createBufferInfoFromArrays(gl, {
position: { numComponents: 2, data: positions, },
displacement: { numComponents: 3, data: displacements, },
indices: indices,
});
// this will be replaced when the image has loaded;
var img = { width: 1, height: 1 };
const tex = twgl.createTexture(gl, {
src: 'https://farm6.staticflickr.com/5078/14032935559_8c13e9b181_z_d.jpg',
crossOrigin: '',
}, function(err, texture, source) {
img = source;
});
var currentTime = 0;
var currentMatrix;
const timeToGoBack = 2; // in seconds;
function render(time) {
time *= 0.001; // convert to seconds
currentTime = time;
twgl.resizeCanvasToDisplaySize(gl.canvas);
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
gl.useProgram(programInfo.program);
var aspect = img.width / img.height;
var mat = m4.ortho(0, gl.canvas.clientWidth, gl.canvas.clientHeight, 0, -1, 1);
mat = m4.translate(mat, [gl.canvas.clientWidth / 2, gl.canvas.clientHeight / 2, 0]);
mat = m4.scale(mat, [img.width * .25, img.height * .25, 1]);
currentMatrix = mat;
// calls gl.bindBuffer, gl.vertexAttribPointer to setup
// attributes
twgl.setBuffersAndAttributes(gl, programInfo, bufferInfo);
twgl.setUniforms(programInfo, {
u_matrix: mat,
u_texture: tex,
u_time: currentTime,
u_timeToGoBack: timeToGoBack,
});
gl.drawElements(gl.TRIANGLES, bufferInfo.numElements, gl.UNSIGNED_SHORT, 0);
requestAnimationFrame(render);
}
requestAnimationFrame(render);
const displace = new Float32Array(3);
gl.canvas.addEventListener('mousemove', function(event, target) {
target = target || event.target;
const rect = target.getBoundingClientRect();
const rx = event.clientX - rect.left;
const ry = event.clientY - rect.top;
const x = rx * target.width / target.clientWidth;
const y = ry * target.height / target.clientHeight;
// reverse project the mouse onto the image
var rmat = m4.inverse(currentMatrix);
var s = m4.transformPoint(
rmat, [x / target.width * 2 - 1, y / target.height * 2 - 1, 0]);
// s is now a point in the space of `position`
// lets just move closest point?
var gx = Math.round((s[0] * .5 + .5) * res);
var gy = Math.round((s[1] * .5 + .5) * res);
gx = clamp(gx, 0, res - 1);
gy = clamp(gy, 0, res - 1);
const offset = ((res - gy - 1) * res + gx) * 3 * 4;
displace[0] = rand(-.1, .1);
displace[1] = rand(-.1, .1);
displace[2] = currentTime + timeToGoBack;
gl.bindBuffer(gl.ARRAY_BUFFER, bufferInfo.attribs.displacement.buffer);
gl.bufferSubData(gl.ARRAY_BUFFER, offset, displace);
});
function rand(min, max) {
return Math.random() * (max - min) + min;
}
function clamp(v, min, max) {
return Math.max(min, Math.min(max, v));
}
body {
margin: 0;
}
canvas {
width: 100vw;
height: 100vh;
display: block;
}
<script src="https://twgljs.org/dist/4.x/twgl-full.min.js"></script>
<canvas></canvas>
对于第二个,你制作了一个置换贴图,而不是置换顶点,随着时间的推移,你将该置换重置为 0
你可以看到 fading things out here 的例子.如果您采用该样本而不是在鼠标下绘制随机正方形,则使用该纹理作为主图像的置换。所谓位移,我的意思是通常您会像这样在片段着色器中查找纹理
vec4 color = texture2D(someTexture, someTextureCoords);
相反,你想用位移来置换顶点坐标,就像这样
// assuming the displacement texture is the same size as
// the main texture you can use the same texture coords
// first look up the displacement and convert to -1 <-> 1 range
// we're only using the R and G channels which will become U and V
// displacements to our texture coordinates
vec2 displacement = texture2D(displacementTexture, someTextureCoords).rg * 2. - 1.;
vec2 uv = someTextureCoords + displacement * displacementRange;
vec4 color = texture2d(someTexture, uv);
这是上面链接的用于位移的示例
var vs = `
attribute vec4 position;
uniform mat4 u_matrix;
void main() {
gl_Position = u_matrix * position;
}
`;
var fs = `
precision mediump float;
uniform vec4 u_color;
void main() {
gl_FragColor = u_color;
}
`;
var vsQuad = `
attribute vec4 position;
attribute vec2 texcoord;
varying vec2 v_texcoord;
void main() {
gl_Position = position;
v_texcoord = texcoord;
}
`;
var fsFade = `
precision mediump float;
varying vec2 v_texcoord;
uniform sampler2D u_texture;
uniform float u_mixAmount;
const float kEpsilon = 2./256.;
void main() {
// convert color from 0.->1. to -1. -> +1. so we can go adjust toward zero
vec4 color = texture2D(u_texture, v_texcoord) * 2. - 1.;
// figure out how much to adjust
vec4 adjust = -color * u_mixAmount;
// If the adjustment is too small (because the texture is only 8bits)
// the adjust the minimum amount.
// Could also solve this by using floating point textures
adjust = mix(adjust, sign(color) * -kEpsilon, step(abs(adjust), vec4(kEpsilon)));
// adjust it
color += adjust;
// write it back converting back to 0 -> 1
gl_FragColor = color * .5 + .5;
}
`;
var fsDisplace = `
precision mediump float;
varying vec2 v_texcoord;
uniform sampler2D u_texture;
uniform sampler2D u_displacementTexture;
uniform vec2 u_displacementRange;
void main() {
// assuming the displacement texture is the same size as
// the main texture you can use the same texture coords
// first look up the displacement and convert to -1 <-> 1 range
// we're only using the R and G channels which will become U and V
// displacements to our texture coordinates
vec2 displacement = texture2D(u_displacementTexture, v_texcoord).rg * 2. - 1.;
vec2 uv = v_texcoord + displacement * u_displacementRange;
gl_FragColor = texture2D(u_texture, uv);
}
`;
var $ = document.querySelector.bind(document);
var mixAmount = 0.03;
var gl = $("canvas").getContext("webgl");
var m4 = twgl.m4;
var programInfo = twgl.createProgramInfo(gl, [vs, fs]);
var fadeProgramInfo = twgl.createProgramInfo(gl, [vsQuad, fsFade]);
var displaceProgramInfo = twgl.createProgramInfo(gl, [vsQuad, fsDisplace]);
// this will be replaced when the image has loaded;
var img = { width: 1, height: 1 };
const tex = twgl.createTexture(gl, {
src: 'https://farm6.staticflickr.com/5078/14032935559_8c13e9b181_z_d.jpg',
crossOrigin: '',
flipY: true,
}, function(err, texture, source) {
img = source;
});
// Creates a -1 to +1 quad
var quadBufferInfo = twgl.primitives.createXYQuadBufferInfo(gl);
// Creates 2 RGBA texture + depth framebuffers
var fadeAttachments = [
{ format: gl.RGBA, min: gl.NEAREST, max: gl.NEAREST, wrap: gl.CLAMP_TO_EDGE, },
{ format: gl.DEPTH_STENCIL },
];
var fadeFbi1 = twgl.createFramebufferInfo(gl, fadeAttachments);
var fadeFbi2 = twgl.createFramebufferInfo(gl, fadeAttachments);
function drawThing(gl, x, y, rotation, scale, color) {
var matrix = m4.ortho(0, gl.canvas.width, gl.canvas.height, 0, -1, 1);
matrix = m4.translate(matrix, [x, y, 0]);
matrix = m4.rotateZ(matrix, rotation);
matrix = m4.scale(matrix, [scale, scale, 1]);
gl.useProgram(programInfo.program);
twgl.setBuffersAndAttributes(gl, programInfo, quadBufferInfo);
twgl.setUniforms(programInfo, {
u_matrix: matrix,
u_color: color,
});
twgl.drawBufferInfo(gl, quadBufferInfo);
}
function rand(min, max) {
if (max === undefined) {
max = min;
min = 0;
}
return min + Math.random() * (max - min);
}
function render(time) {
if (twgl.resizeCanvasToDisplaySize(gl.canvas)) {
// set the clear color to 0.5 which is 0 displacement
// for our shader
gl.clearColor(0.5, 0.5, 0.5, 0.5);
// resize the framebuffer's attachments so their the
// same size as the canvas
twgl.resizeFramebufferInfo(gl, fadeFbi1, fadeAttachments);
// clear the color buffer to 0.5
twgl.bindFramebufferInfo(gl, fadeFbi1);
gl.clear(gl.COLOR_BUFFER_BIT);
// resize the 2nd framebuffer's attachments so their the
// same size as the canvas
twgl.resizeFramebufferInfo(gl, fadeFbi2, fadeAttachments);
// clear the color buffer to 0.5
twgl.bindFramebufferInfo(gl, fadeFbi2);
gl.clear(gl.COLOR_BUFFER_BIT);
}
// fade by copying from fadeFbi1 into fabeFbi2 using mixAmount.
// fadeFbi2 will contain mix(fadeFb1, u_fadeColor, u_mixAmount)
twgl.bindFramebufferInfo(gl, fadeFbi2);
gl.useProgram(fadeProgramInfo.program);
twgl.setBuffersAndAttributes(gl, fadeProgramInfo, quadBufferInfo);
twgl.setUniforms(fadeProgramInfo, {
u_texture: fadeFbi1.attachments[0],
u_mixAmount: mixAmount,
});
twgl.drawBufferInfo(gl, quadBufferInfo);
// now draw new stuff to fadeFb2. Notice we don't clear!
twgl.bindFramebufferInfo(gl, fadeFbi2);
var x = rand(gl.canvas.width);
var y = rand(gl.canvas.height);
var rotation = rand(Math.PI);
var scale = rand(10, 20);
var color = [rand(1), rand(1), rand(1), 1];
drawThing(gl, x, y, rotation, scale, color);
// now use fadeFbi2 as a displacement while drawing tex to the canvas
twgl.bindFramebufferInfo(gl, null);
gl.useProgram(displaceProgramInfo.program);
twgl.setBuffersAndAttributes(gl, displaceProgramInfo, quadBufferInfo);
twgl.setUniforms(displaceProgramInfo, {
u_texture: tex,
u_displacementTexture: fadeFbi2.attachments[0],
u_displacementRange: [0.1, 0.1],
});
twgl.drawBufferInfo(gl, quadBufferInfo);
// swap the variables so we render to the opposite textures next time
var temp = fadeFbi1;
fadeFbi1 = fadeFbi2;
fadeFbi2 = temp;
requestAnimationFrame(render);
}
requestAnimationFrame(render);
body { margin: 0; }
canvas { display: block; width: 100vw; height: 100vh; }
<script src="https://twgljs.org/dist/4.x/twgl-full.min.js"></script>
<canvas></canvas>
所以剩下的就是让它在鼠标下绘制而不是随机绘制
var vs = `
attribute vec4 position;
uniform mat4 u_matrix;
void main() {
gl_Position = u_matrix * position;
}
`;
var fs = `
precision mediump float;
uniform vec4 u_color;
void main() {
gl_FragColor = u_color;
}
`;
var vsQuad = `
attribute vec4 position;
attribute vec2 texcoord;
uniform mat4 u_matrix;
varying vec2 v_texcoord;
void main() {
gl_Position = u_matrix * position;
v_texcoord = texcoord;
}
`;
var fsFade = `
precision mediump float;
varying vec2 v_texcoord;
uniform sampler2D u_texture;
uniform float u_mixAmount;
const float kEpsilon = 2./256.;
void main() {
vec4 color = texture2D(u_texture, v_texcoord) * 2. - 1.;
vec4 adjust = -color * u_mixAmount;
adjust = mix(adjust, sign(color) * -kEpsilon, step(abs(adjust), vec4(kEpsilon)));
color += adjust;
gl_FragColor = color * .5 + .5;
}
`;
var fsDisplace = `
precision mediump float;
varying vec2 v_texcoord;
uniform sampler2D u_texture;
uniform sampler2D u_displacementTexture;
uniform vec2 u_displacementRange;
void main() {
// assuming the displacement texture is the same size as
// the main texture you can use the same texture coords
// first look up the displacement and convert to -1 <-> 1 range
// we're only using the R and G channels which will become U and V
// displacements to our texture coordinates
vec2 displacement = texture2D(u_displacementTexture, v_texcoord).rg * 2. - 1.;
vec2 uv = v_texcoord + displacement * u_displacementRange;
gl_FragColor = texture2D(u_texture, uv);
}
`;
var $ = document.querySelector.bind(document);
var mixAmount = 0.03;
var gl = $("canvas").getContext("webgl");
var m4 = twgl.m4;
var programInfo = twgl.createProgramInfo(gl, [vs, fs]);
var fadeProgramInfo = twgl.createProgramInfo(gl, [vsQuad, fsFade]);
var displaceProgramInfo = twgl.createProgramInfo(gl, [vsQuad, fsDisplace]);
// this will be replaced when the image has loaded;
var img = { width: 1, height: 1 };
const tex = twgl.createTexture(gl, {
src: 'https://farm6.staticflickr.com/5078/14032935559_8c13e9b181_z_d.jpg',
crossOrigin: '',
}, function(err, texture, source) {
img = source;
});
// Creates a -1 to +1 quad
var quadBufferInfo = twgl.primitives.createXYQuadBufferInfo(gl);
// Creates 2 RGBA texture + depth framebuffers
var fadeAttachments = [
{ format: gl.RGBA,
min: gl.NEAREST,
max: gl.NEAREST,
wrap: gl.CLAMP_TO_EDGE,
},
];
var fadeFbi1 = twgl.createFramebufferInfo(gl, fadeAttachments);
var fadeFbi2 = twgl.createFramebufferInfo(gl, fadeAttachments);
function drawThing(gl, x, y, rotation, scale, color) {
var matrix = m4.ortho(0, gl.canvas.width, gl.canvas.height, 0, -1, 1);
matrix = m4.translate(matrix, [x, y, 0]);
matrix = m4.rotateZ(matrix, rotation);
matrix = m4.scale(matrix, [scale, scale, 1]);
gl.useProgram(programInfo.program);
twgl.setBuffersAndAttributes(gl, programInfo, quadBufferInfo);
twgl.setUniforms(programInfo, {
u_matrix: matrix,
u_color: color,
});
twgl.drawBufferInfo(gl, quadBufferInfo);
}
function rand(min, max) {
if (max === undefined) {
max = min;
min = 0;
}
return min + Math.random() * (max - min);
}
var drawRect = false;
var rectX;
var rectY;
var currentMatrix;
function render(time) {
if (twgl.resizeCanvasToDisplaySize(gl.canvas)) {
// set the clear color to 0.5 which is 0 displacement
// for our shader
gl.clearColor(0.5, 0.5, 0.5, 0.5);
// resize the framebuffer's attachments so their the
// same size as the canvas
twgl.resizeFramebufferInfo(gl, fadeFbi1, fadeAttachments);
// clear the color buffer to 0.5
twgl.bindFramebufferInfo(gl, fadeFbi1);
gl.clear(gl.COLOR_BUFFER_BIT);
// resize the 2nd framebuffer's attachments so their the
// same size as the canvas
twgl.resizeFramebufferInfo(gl, fadeFbi2, fadeAttachments);
// clear the color buffer to 0.5
twgl.bindFramebufferInfo(gl, fadeFbi2);
gl.clear(gl.COLOR_BUFFER_BIT);
}
// fade by copying from fadeFbi1 into fabeFbi2 using mixAmount.
// fadeFbi2 will contain mix(fadeFb1, u_fadeColor, u_mixAmount)
twgl.bindFramebufferInfo(gl, fadeFbi2);
gl.useProgram(fadeProgramInfo.program);
twgl.setBuffersAndAttributes(gl, fadeProgramInfo, quadBufferInfo);
twgl.setUniforms(fadeProgramInfo, {
u_matrix: m4.identity(),
u_texture: fadeFbi1.attachments[0],
u_mixAmount: mixAmount,
});
twgl.drawBufferInfo(gl, quadBufferInfo);
if (drawRect) {
drawRect = false;
// now draw new stuff to fadeFb2. Notice we don't clear!
twgl.bindFramebufferInfo(gl, fadeFbi2);
var rotation = rand(Math.PI);
var scale = rand(10, 20);
var color = [rand(1), rand(1), rand(1), 1];
drawThing(gl, rectX, rectY, rotation, scale, color);
}
// now use fadeFbi2 as a displacement while drawing tex to the canvas
twgl.bindFramebufferInfo(gl, null);
var mat = m4.ortho(0, gl.canvas.clientWidth, gl.canvas.clientHeight, 0, -1, 1);
mat = m4.translate(mat, [gl.canvas.clientWidth / 2, gl.canvas.clientHeight / 2, 0]);
mat = m4.scale(mat, [img.width * 0.5, img.height * 0.5, 1]);
currentMatrix = mat;
gl.useProgram(displaceProgramInfo.program);
twgl.setBuffersAndAttributes(gl, displaceProgramInfo, quadBufferInfo);
twgl.setUniforms(displaceProgramInfo, {
u_matrix: mat,
u_texture: tex,
u_displacementTexture: fadeFbi2.attachments[0],
u_displacementRange: [0.05, 0.05],
});
twgl.drawBufferInfo(gl, quadBufferInfo);
// swap the variables so we render to the opposite textures next time
var temp = fadeFbi1;
fadeFbi1 = fadeFbi2;
fadeFbi2 = temp;
requestAnimationFrame(render);
}
requestAnimationFrame(render);
gl.canvas.addEventListener('mousemove', function(event, target) {
target = target || event.target;
const rect = target.getBoundingClientRect();
const rx = event.clientX - rect.left;
const ry = event.clientY - rect.top;
const x = rx * target.width / target.clientWidth;
const y = ry * target.height / target.clientHeight;
// reverse project the mouse onto the image
var rmat = m4.inverse(currentMatrix);
var clipspacePoint = [x / target.width * 2 - 1, -(y / target.height * 2 - 1), 0];
var s = m4.transformPoint(rmat, clipspacePoint);
// s is now a point in the space of the image's quad. The quad goes -1 to 1
// and we're going to draw into it using pixels because drawThing takes
// a pixel value and our displacement map is the same size as the canvas
drawRect = true;
rectX = ( s[0] * .5 + .5) * gl.canvas.width;
rectY = (-s[1] * .5 + .5) * gl.canvas.height;
});
body { margin: 0; }
canvas { display: block; width: 100vw; height: 100vh; }
<script src="https://twgljs.org/dist/4.x/twgl-full.min.js"></script>
<canvas></canvas>
获得第二个示例的确切效果看起来像是通过某种噪声函数运行位移。你可以使用类似 WebGL Inspector 的东西或 Shader Editor查看着色器内部并查看它们在做什么。
Here's another example这会创建一个位移纹理,该纹理比边缘更向中心位移。
注意:我应该说清楚,我没有查看您链接到的示例如何工作的细节,我只是建议他们正在做一些类似的事情。找出他们真正在做什么的最好方法是查看他们的代码并运行前面段落中提到的工具来查看内部并了解发生了什么。也许他们没有使用直接位移,而是使用法线之类的东西作为位移。也许他们不是绘制纯色(第二个和第三个示例)或纹理(第四个示例),而是使用程序生成的图案或使用基于屏幕的纹理坐标来绘制重复纹理图案。也许置换贴图是一个单独的贴图,他们有一个“混合蒙版”,用白色绘制并逐渐变为黑色,以决定应用多少置换贴图。在 WebGL 中有无数种方法可以做事。
关于javascript - 使用 webgl 在鼠标移动上创建一个连续动画回到原始状态的涂抹/液化效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42049942/
如何检查一个元素是否立即隐藏。即如何通知元素的可见性。 在我的例子中,该元素是通过 slideUp 函数隐藏的。我应该立即收到有关该元素的可见性的通知。 我想到了使用bind()方法。但它没有类似 o
if (srcbloc == NULL) { fprintf(stderr, "warning!: memrip source is null!\n"); exit(1); } if
当我在数据库的旧 View 中清理一些问题时,我遇到了这个“奇怪”的连接条件: from tblEmails [e] join tblPersonEmails [pe]
如何水平对齐多张图像,一张一张地?它们不必适合宽度屏幕:相反,我希望它们超过后者的宽度,如果这有任何意义的话。 我已经检查了很多类似问题的答案,但找不到任何可以解决我的问题的答案。 HTML:
我知道 Cassandra 中的列有 TTL。但是也可以在一行上设置 TTL 吗?在每列上设置 TTL 并不能解决我的问题,如下面的用例所示: 在某些时候,一个进程想要删除一个带有 TTL 的完整行(
我有一个 NSTextField 和 Label,其值绑定(bind)到 View Controller 中的相同 NSString 这里的问题是标签只有在我按 Tab 时才会更新。 如何使其连续,以
例如。 1."abc"; ===>abc 2."ab c"; ===>ab_c 3."ab c"; ===>ab_c 4."ab c" ===>ab_c 对于多个连续空格也是如此。 我怎样
大家好,我想获取前一天或最后一天的信息,只有当我按下按钮时,它才会显示最后一天(星期六)的所有信息,如果我再次单击按钮,它将显示最后一天的信息(星期五)如果我再次点击它(星期四)谢谢你们帮助我 编辑:
我需要从实时音频流中提取ICY元数据,并正在使用mplayer进行此操作,因为它在播放音频流时会输出元数据。我欢迎其他方式执行此操作,目标是将更新的元数据(歌曲信息)保存到文本文件中,只要歌曲(或数据
语音识别有没有解决方案 只有几个字(2 个就够了,10 个就不错了。100 个就很棒了。不需要更多) 也在移动浏览器上运行(是否可以为此使用 flash(而不是 java)?) 可以安装在您自己的服务
我有一个单词列表, list1 = ['hello', 'how', 'are', 'you?', 'i', 'am', 'fine', 'thanks.', 'great!'] 我想加入, list
我正在开发一个程序,但我不断收到“对‘dosell’的 undefined reference ”,我不太明白发生了什么。这是函数的声明: void dosell(int *cash, int *nu
我无法提出执行我要做的事情所需的查询。 我有三个这样的表: client_files ----------------------- client_id file_id ---------
我一直在寻找一个插件/脚本,当到达底部时,它会从头开始继续滚动网站,就像一个连续的循环。 示例:http://unfold.no/和 http://www.aquiesdonde.com.ar/ 我尝
这个问题在这里已经有了答案: How to prevent scanf causing a buffer overflow in C? (6 个答案) 关闭 6 年前。 我一直在使用一个非常简单的程
给定一个整数数组,找到具有相同数量的 x 和 y 的连续子序列的总数。例如 x=1 和 y=2 的数组 [1,2,1] ans = 2 表示它的两个子数组 [1,2] 和 [2,1]。检查每个连续的子
所以,我有一个所有正自然数的数组。我得到了一个阈值。我必须找出总和小于给定阈值的数字(连续)的最大计数。 For example, IP: arr = {3,1,2,1} Threshold = 5
我制作了像内置相机一样的相机应用。 我想实现像内置相机一样的连续对焦功能。(此功能我不触摸屏幕,但相机会尝试自行对焦。) 因此,将其设置为 surfaceCreated : Camera.Pa
我有这样的数据: f x A 1.1 A 2.2 A 3.3 B 3.5 B 3.7 B 3.9 B 4.1 B 4.5 A 5.1 A 5.2 C 5.4 C 5.5 C 6.1 B 6.2 B
假设我有一个包含一组数据点的表,每个数据点由一个时间戳和一个值组成。如果至少有 N 个连续记录(按时间戳排序)高于给定值 X,我将如何编写返回 true (1) 的查询,否则返回 false (0)?
我是一名优秀的程序员,十分优秀!