发新帖  新投票  回帖 
33968个阅读者,51条回复 | 打印 | 订阅 | 收藏
wu341

发表时间:2021-9-10 11:42

赠:秋水如泓,祝教师节快乐!



wu341 发表在 音乐播放器 华声论坛 http://bbs.voc.com.cn/forum-344-1.html


[全屏欣赏]







[本帖最后由 兰蕙hn 于 2021-9-10 15:20 编辑]

回帖推荐
喜欢这首歌,听着甜甜的美美的,童音纯真,鼓励多多,对老师是巨大的鞭策。图图漂亮,背景色调清爽,折纸飞机寓意深刻,会带着孩子们的梦想飞向太空。频谱绚丽,一团火焰不断喷射出光芒,也是美好的寓意。播放器简约,长短与后面的几案成梯形等比例,精心设计啊。简约而不简单的图形,一看就是制图技术大师哦。非常喜欢的

本帖助威记录

天狼2021 +1
看了楼主的帖,神马都是浮云
2021-09-18 19:26:37
乱了浮生1 +5
你的帖子可以上新闻联播了
2021-09-18 10:54:08
景艺 +1
你的帖子可以上新闻联播了
2021-09-17 20:12:55
燕燕hs +5
你的帖子可以上新闻联播了
2021-09-16 19:22:52
若相爱 +5
你的帖子可以上新闻联播了
2021-09-16 15:53:38
总计:魅力76点 助威18查看所有助威>>
 
wu341

回复时间:2021-9-10 11:44
Firework类:import fengzi.spectrum.Firework

/**
*
* *--------------------*
* | *** 火花效果 *** |
* *--------------------*
*
* 编辑修改收录:fengzi(疯子、wu341、wgq341)
*
* 不会写代码,我是代码搬运工。
*
* 联系方式:QQ(493712833)。
*
* 随 笔: [url]https://www.cnblogs.com/fengziwu/[/url]
*
* 版权协议:请自觉遵守LGPL协议,欢迎修改、复制、转载、传播给更多需要的人。
* 免责声明:任何因使用此软件导致的纠纷与软件/程序开发者无关。
* 日 期: 2015.04.23
*/

package fengzi.spectrum
{
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import flash.media.SoundMixer;
import flash.utils.ByteArray;


public class Firework extends Sprite
{

private var position:Vector.<Number> = new Vector.<Number>();
private var velocity:Vector.<Number> = new Vector.<Number>();
private var diameters:Vector.<Number> = new Vector.<Number>();
private var sparkNumber:Number = 0;

private var projectedPosition:Vector.<Number> = new Vector.<Number>();
private var uvts:Vector.<Number> = new Vector.<Number>();

private var sparkBitmapDatas:Vector.<BitmapData> = new Vector.<BitmapData>();
private var sparkBitmapDataRectangles:Vector.<Rectangle> = new Vector.<Rectangle>();
private const SPARK_COLOR:uint = 0x664020;

private const GRAVITY:Number = 0.02;
private const AIR_RESISTANCE:Number = 0.999;


private const EMIT_SPARK_NUMBER:int = 3;


private var reflectionBitmapData:BitmapData;
private const REFLECTION_COLOR:uint = 0xFF1800;
private const REFLECTION_RADIUS:Number = 16;


private var displayBuffer:BitmapData;
private var splitBuffer:BitmapData;
private const NUMBER_OF_SPLIT_FRAME:int = 10;

private var perspective:PerspectiveProjection = new PerspectiveProjection();
private var projectionMatrix:Matrix3D = new Matrix3D();

private var viewRotationY:Number = 0;
private var viewRotationX:Number = 25;

private var center_x:Number;
private var center_y:Number;
private const FLOOR_SIZE:Number = 300;
private const FLOOR_HALFSIZE:Number = FLOOR_SIZE / 2;
private const FLOOR_VERTICES:Vector.<Number> = Vector.<Number>([
FLOOR_HALFSIZE, 0, FLOOR_HALFSIZE,
-FLOOR_HALFSIZE, 0, FLOOR_HALFSIZE,
-FLOOR_HALFSIZE, 0, -FLOOR_HALFSIZE,
FLOOR_HALFSIZE, 0, -FLOOR_HALFSIZE,

FLOOR_HALFSIZE, 0, 0,
-FLOOR_HALFSIZE, 0, 0,
0, 0, FLOOR_HALFSIZE,
0, 0, -FLOOR_HALFSIZE,
]);
private const FIREWORK_RADIUS:Number = 8;
private const FIREWORK_HEIGHT:Number = 40;
private const FIREWORK_COLOR:uint = 0xAACCFF;

private var fireworkVertices:Vector.<Number> = new Vector.<Number>();
private var fireworkIndices:Vector.<int> = new Vector.<int>();
private var fireworkProjectedVertices:Vector.<Number> = new Vector.<Number>();
private var fireworkUvts:Vector.<Number> = new Vector.<Number>();

private const FLOOR_VERTEX_NUMBER:int = FLOOR_VERTICES.length / 3;

private var floorProjectedVertices:Vector.<Number> = new Vector.<Number>();
private var floorIndices:Vector.<int> = Vector.<int>([
0, 1, 2, 2, 3, 0
]);
private var floorUvts:Vector.<Number> = Vector.<Number>([
1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]);

private const TEXTURE_SIZE:int = 150;
private var floorTexture:BitmapData = new BitmapData(TEXTURE_SIZE,TEXTURE_SIZE,false);

private const WIREFRAME_COLOR:uint = 0x555566;

private var sprite:Sprite = new Sprite();

private var stats:TextField = new TextField();

var player:*;
private var byteArray:ByteArray;
var isBack:Boolean

/**
* 构造函数
* @param w 频谱宽度
* @param h 频谱高度
* @param isBack 是否有黑色背景(默认false有)
*/

public function Firework(w:Number=550,h:Number=400,isBack:Boolean=false)
{
this.isBack=isBack
center_x =w/2
center_y =h*0.65
byteArray = new ByteArray();
displayBuffer = new BitmapData(w,h,isBack,0);
splitBuffer = new BitmapData(w,h,isBack,0);

addChild(new Bitmap(displayBuffer));

stats.x = 5;
stats.y = 5;
stats.autoSize = TextFieldAutoSize.LEFT;
stats.textColor = 0xFFFFFF;
//addChild(stats);

var shape:Shape = new Shape();
var g:Graphics = shape.graphics;


var bitmapData:BitmapData = new BitmapData(1,1,false,SPARK_COLOR);
sparkBitmapDatas.push(bitmapData);
sparkBitmapDataRectangles.push(bitmapData.rect);

for (var diameter:int = 1; diameter <= 32; diameter++)
{
bitmapData = new BitmapData(diameter,diameter,false,0);

g.clear();
g.beginFill(SPARK_COLOR);
var radius:Number = diameter / 2;
g.drawCircle(radius, radius, radius);
g.endFill();
bitmapData.draw(shape);

sparkBitmapDatas.push(bitmapData);
sparkBitmapDataRectangles.push(bitmapData.rect);

}


reflectionBitmapData = new BitmapData(REFLECTION_RADIUS * 2, REFLECTION_RADIUS * 2, false, 0);
g.clear();
var matrix:Matrix = new Matrix();
matrix.createGradientBox(REFLECTION_RADIUS * 2, REFLECTION_RADIUS * 2, 0, 0, 0);
g.beginGradientFill(GradientType.RADIAL, [ REFLECTION_COLOR, REFLECTION_COLOR ], [ 1, 0 ], [ 0, 255 ], matrix);
g.drawCircle(REFLECTION_RADIUS, REFLECTION_RADIUS, REFLECTION_RADIUS);
g.endFill();
reflectionBitmapData.draw(shape);

createFireworkModel();

this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}

private function enterFrameHandler(e:Event):void
{
displayBuffer.fillRect(displayBuffer.rect, 0);

setupProjectionMatrix();

var startTime:uint = getTimer();
renderFloor();
var floorRenderingTime:uint = getTimer() - startTime;

startTime = getTimer();
for (var i:int = 0; i < NUMBER_OF_SPLIT_FRAME; i++)
{
const FACTOR:Number = 0.06;

setupProjectionMatrix();

for (var j:int = 0; j < EMIT_SPARK_NUMBER; j++)
{
emitSpark();
}
updateSparks();
renderSparks();
}
var sparksRenderingTime:uint = getTimer() - startTime;

stats.text =
"Number of Sparks : " + sparkNumber + "\n" +
"Floor Rendering Time : " + floorRenderingTime + " ms\n" +
"Sparks Rendering Time : " + sparksRenderingTime + " ms \n";
}

private function setupProjectionMatrix():void
{
perspective.fieldOfView = 60;

projectionMatrix.identity();
projectionMatrix.appendRotation(viewRotationY, Vector3D.Y_AXIS);
projectionMatrix.appendRotation(viewRotationX, Vector3D.X_AXIS);
projectionMatrix.appendTranslation(0, 0, perspective.focalLength);
projectionMatrix.append(perspective.toMatrix3D());

correctMatrix3DMultiplyBug(projectionMatrix);
}

private function correctMatrix3DMultiplyBug(matrix:Matrix3D):void
{

var m1:Matrix3D = new Matrix3D(Vector.<Number > ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0]));
var m2:Matrix3D = new Matrix3D(Vector.<Number > ([0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0]));
m1.append(m2);
if (m1.rawData[15] == 20)
{

var rawData:Vector.<Number > = matrix.rawData;
rawData[15] /= 20;
matrix.rawData = rawData;
}
}

private function createSpark(x:Number, y:Number, z:Number, vx:Number, vy:Number, vz:Number, diameter:Number):void
{
position.push(x, y, z);
velocity.push(vx, vy, vz);
diameters.push(diameter);
sparkNumber++;
}

private function emitSpark():void
{
var azimuth:Number = Math.random() * 2 * Math.PI;
var vy:Number = -(Math.random() * 0.06 + 0.94);
var vx:Number = Math.sqrt(1 - vy * vy) * Math.cos(azimuth);
var vz:Number = Math.sqrt(1 - vy * vy) * Math.sin(azimuth);


//////////////////////////////
SoundMixer.computeSpectrum(byteArray, true, 32);
var num:Number = byteArray.readFloat() * 1.8;
var speed:Number = Math.random() * (num + 0.6) + 0.7;
vx *= speed;
vy *= speed;
vz *= speed;

var diameter:Number = 3 + Math.random() * (num + 1);
createSpark(0, -FIREWORK_HEIGHT, 0, vx, vy, vz, diameter);
}

private function updateSparks():void
{
for (var i:int = 0; i < sparkNumber; )
{
var xIndex:int = i * 3;
var yIndex:int = xIndex + 1;
var zIndex:int = xIndex + 2;

velocity[yIndex] += GRAVITY;

velocity[xIndex] *= AIR_RESISTANCE;
velocity[yIndex] *= AIR_RESISTANCE;
velocity[zIndex] *= AIR_RESISTANCE;

if (position[yIndex] + velocity[yIndex] > 0)
{
velocity[yIndex] = - velocity[yIndex] * 0.2;

position[xIndex] += velocity[xIndex];
position[yIndex] += velocity[yIndex];
position[zIndex] += velocity[zIndex];


const DIAMETER_MIN:Number = 2;
if (diameters[i] > DIAMETER_MIN)
{
var diameterLimit:Number = diameters[i];

while (1)
{
var diameter:Number = Math.random() * (4 - DIAMETER_MIN) + DIAMETER_MIN;
diameterLimit -= diameter;
if (diameterLimit < 0)
{
break;
}
var azimuth:Number = Math.random() * 2 * Math.PI;
var r:Number = Math.random() * 2;

createSpark(position[xIndex], position[yIndex], position[zIndex],
(velocity[xIndex] + Math.cos(azimuth) * r) * 0.5,

velocity[yIndex],
(velocity[zIndex] + Math.sin(azimuth) * r) * 0.5,
diameter);
}
}



position[xIndex] = position[sparkNumber * 3 - 3];
position[yIndex] = position[sparkNumber * 3 - 2];
position[zIndex] = position[sparkNumber * 3 - 1];

velocity[xIndex] = velocity[sparkNumber * 3 - 3];
velocity[yIndex] = velocity[sparkNumber * 3 - 2];
velocity[zIndex] = velocity[sparkNumber * 3 - 1];

diameters[i] = diameters[sparkNumber - 1];

position.pop();
position.pop();
position.pop();

velocity.pop();
velocity.pop();
velocity.pop();

diameters.pop();

sparkNumber--;
continue;
}
position[xIndex] += velocity[xIndex];
position[yIndex] += velocity[yIndex];
position[zIndex] += velocity[zIndex];

i++;
}
}

private function renderSparks():void
{
splitBuffer.fillRect(splitBuffer.rect, 0x000000);

Utils3D.projectVectors(projectionMatrix, position, projectedPosition, uvts);


var p:Point = new Point();
var focalLength:Number = perspective.focalLength;

for (var i:int = 0; i < sparkNumber; i++)
{

var diameter:int = uvts[i * 3 + 2] * focalLength * diameters[i] + 0.5;

p.x = center_x + projectedPosition[(i << 1)] - diameter / 2;
p.y = center_y + projectedPosition[(i << 1) + 1] - diameter / 2;
splitBuffer.copyPixels(sparkBitmapDatas[diameter], sparkBitmapDataRectangles[diameter], p);
}

displayBuffer.draw(splitBuffer, null, null, BlendMode.ADD);
}
private function renderFloor():void
{
const THRESHOLD_Y:Number = 50;
var matrix:Matrix = new Matrix();
var colorTransform:ColorTransform = new ColorTransform();
floorTexture.fillRect(floorTexture.rect,0x180C00);
for (var i:int=0; i<sparkNumber; i++)
{
var yIndex:int = i * 3 + 1;
if (position[yIndex] > - THRESHOLD_Y)
{
var xIndex:int = i * 3;
var zIndex:int = i * 3 + 2;
matrix.identity();
var scale:Number =(0.2-(position[yIndex]/THRESHOLD_Y)*0.8)*diameters[i];
matrix.translate(FLOOR_HALFSIZE+position[xIndex]-REFLECTION_RADIUS*scale,FLOOR_HALFSIZE-position[zIndex]-REFLECTION_RADIUS*scale);
matrix.scale(TEXTURE_SIZE/FLOOR_SIZE,TEXTURE_SIZE/FLOOR_SIZE);
colorTransform.alphaMultiplier = 1 + position[yIndex] / THRESHOLD_Y;
floorTexture.draw(reflectionBitmapData,matrix,colorTransform,BlendMode.ADD);
}
}
Utils3D.projectVectors(projectionMatrix, FLOOR_VERTICES, floorProjectedVertices, floorUvts);

for (i = 0; i < FLOOR_VERTEX_NUMBER; i++)
{
floorProjectedVertices[i<<1] += center_x;
floorProjectedVertices[(i<<1)+1] += center_y;
}
for (i = 0; i < fireworkProjectedVertices.length / 2; i++)
{
fireworkProjectedVertices[i<<1] += center_x;
fireworkProjectedVertices[(i<<1)+1] += center_y;
}


/*for (i = 0; i < FLOOR_VERTEX_NUMBER; i++)
{
floorProjectedVertices[(i << 1) ] += center_x;
floorProjectedVertices[(i << 1) + 1] += center_y;
}*







/*Utils3D.projectVectors(projectionMatrix, fireworkVertices, fireworkProjectedVertices, fireworkUvts);
for (i = 0; i < fireworkProjectedVertices.length / 2; i++)
{
fireworkProjectedVertices[(i << 1) ] += center_x;
fireworkProjectedVertices[(i << 1) + 1] += center_y;
}*/


var g:Graphics = sprite.graphics;
g.clear();
g.beginBitmapFill(floorTexture);
g.drawTriangles(floorProjectedVertices, floorIndices, floorUvts);
g.endFill();
displayBuffer.draw(sprite);

g.clear();
g.lineStyle(1, WIREFRAME_COLOR);
g.moveTo(floorProjectedVertices[0], floorProjectedVertices[1]);
g.lineTo(floorProjectedVertices[2], floorProjectedVertices[3]);
g.lineTo(floorProjectedVertices[4], floorProjectedVertices[5]);
g.lineTo(floorProjectedVertices[6], floorProjectedVertices[7]);
g.lineTo(floorProjectedVertices[0], floorProjectedVertices[1]);

g.moveTo(floorProjectedVertices[8], floorProjectedVertices[9]);
g.lineTo(floorProjectedVertices[10], floorProjectedVertices[11]);
g.moveTo(floorProjectedVertices[12], floorProjectedVertices[13]);
g.lineTo(floorProjectedVertices[14], floorProjectedVertices[15]);
displayBuffer.draw(sprite, null, null, BlendMode.ADD);

g.clear();
g.beginFill(FIREWORK_COLOR);
g.drawTriangles(fireworkProjectedVertices, fireworkIndices);
g.endFill();
displayBuffer.draw(sprite);
}







private function createFireworkModel():void
{
const SEGMENT:int = 8;
for (var i:int = 0; i < SEGMENT; i++)
{
var x:Number = Math.cos(2 * Math.PI * i / SEGMENT) * FIREWORK_RADIUS;
var z:Number = Math.sin(2 * Math.PI * i / SEGMENT) * FIREWORK_RADIUS;
fireworkVertices.push(x, -FIREWORK_HEIGHT, z);
fireworkVertices.push(x, 0, z);

var i0:int = (i * 2 ) % (SEGMENT * 2);
var i1:int = (i * 2 + 1) % (SEGMENT * 2);
var i2:int = (i * 2 + 2) % (SEGMENT * 2);
var i3:int = (i * 2 + 3) % (SEGMENT * 2);
fireworkIndices.push(i2, i0, i1);
fireworkIndices.push(i1, i3, i2);
}
}



/*开始*/
public function start():void
{
this.addEventListener(Event.ENTER_FRAME,enterFrameHandler);
}

/*暂停*/
public function pause():void
{
this.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}










}
}

[本帖最后由 wu341 于 2021-9-10 12:08 编辑]

 
若水子矜

回复时间:2021-9-10 15:05
效果漂亮,还有源代码分享,太好了,谢谢疯帅,辛苦了

 
若水子矜

回复时间:2021-9-10 15:05
秋水宝姐收礼开心,教师节快乐

 
若水子矜

回复时间:2021-9-10 15:12
期待更多精彩,周末愉快

 
兰蕙hn
原创音画组

回复时间:2021-9-10 15:33
背景精美漂亮,寓意深远,透视效果好,频谱美美哒
好帖狠赞哦,欣赏问好疯老师,辛苦了!






----------------------------------------------
取个网名叫“兰蕙”,并不是真的认为自己就是兰心蕙质的女人,而是把这作为我的一种追求,一种境界。
 
兰蕙hn
原创音画组

回复时间:2021-9-10 15:37
还有源代码分享,真好,空了学习制作,谢谢疯老师,辛苦了

按此在新窗口浏览图片




----------------------------------------------
取个网名叫“兰蕙”,并不是真的认为自己就是兰心蕙质的女人,而是把这作为我的一种追求,一种境界。
 
兰蕙hn
原创音画组

回复时间:2021-9-10 15:42
祝秋水宝姐教师节快乐,健康幸福,收礼开心哟


按此在新窗口浏览图片按此在新窗口浏览图片按此在新窗口浏览图片按此在新窗口浏览图片按此在新窗口浏览图片按此在新窗口浏览图片




----------------------------------------------
取个网名叫“兰蕙”,并不是真的认为自己就是兰心蕙质的女人,而是把这作为我的一种追求,一种境界。
 
伯懿

回复时间:2021-9-10 16:13
频谱播放器美美哒,谢谢分享。祝秋水如泓老师节日快乐!




----------------------------------------------
愿与草木,随遇而安.
 
秋水如泓

回复时间:2021-9-10 16:24
来收礼啦,谢谢疯帅老师的精美礼物,当老师真好啊!感谢感谢!
按此在新窗口浏览图片

 
秋水如泓

回复时间:2021-9-10 16:46
喜欢这首歌,听着甜甜的美美的,童音纯真,鼓励多多,对老师是巨大的鞭策。
图图漂亮,背景色调清爽,折纸飞机寓意深刻,会带着孩子们的梦想飞向太空。
频谱绚丽,一团火焰不断喷射出光芒,也是美好的寓意。
播放器简约,长短与后面的几案成梯形等比例,精心设计啊。简约而不简单的图形,一看就是制图技术大师哦。
非常喜欢的歌曲,非常喜爱的图图。疯帅老师的风格就是简单明快利落有深度。
谢谢疯帅老师,非常高兴在教师节收到这份意想不到的厚重礼物。
按此在新窗口浏览图片

[本帖最后由 秋水如泓 于 2021-9-10 16:52 编辑]


本帖最近评分记录
兰蕙hn   2021-9-11 10:16  金钱  +18   精彩点评
兰蕙hn   2021-9-11 10:16  魅力  +18   精彩点评
 
秋水如泓

回复时间:2021-9-10 16:51
问好疯帅老师,在网络上你是我们的好老师,祝你节日快乐!

 
zsctqz

回复时间:2021-9-10 19:28
学习!谢谢老师!

 
紫萝青藤

回复时间:2021-9-10 19:51
制作精美 蛐蛐好听 秋水宝姐节日快乐




----------------------------------------------
随遇而安……
 
自由飞翔6888

回复时间:2021-9-10 20:17
漂亮的频谱,好听的歌曲,欣赏点赞




----------------------------------------------
让我们都来热爱音乐吧,让音乐为我们人类造福!
 
自由飞翔6888

回复时间:2021-9-10 20:17
秋水教师节快乐,收礼开心




----------------------------------------------
让我们都来热爱音乐吧,让音乐为我们人类造福!
 
秋水如泓

回复时间:2021-9-10 23:19
看了N遍还是看不明白代码,我寻找音乐要放在哪儿?如何替代?图图地址在哪儿?一点点线索也没有找到。人和人怎就差别那么大啊?惭愧哦。

 
秋水如泓

回复时间:2021-9-10 23:21

原帖由 若水子矜 于 2021-9-10 15:05 发表
秋水宝姐收礼开心,教师节快乐

谢谢若水宝妹老师的祝福哈

 
秋水如泓

回复时间:2021-9-10 23:22

原帖由 兰蕙hn 于 2021-9-10 15:42 发表
祝秋水宝姐教师节快乐,健康幸福,收礼开心哟


按此在新窗口浏览图片按此在新窗口浏览图片按此在新窗口浏览图片按此在新窗口浏览图片按此在新窗口浏览图片按此在新窗口浏览图片

谢谢兰宝的美好祝愿哈,问好。

 
秋水如泓

回复时间:2021-9-10 23:23

原帖由 伯懿 于 2021-9-10 16:13 发表
频谱播放器美美哒,谢谢分享。祝秋水如泓老师节日快乐!

问好佰懿,谢谢你的节日祝福

 
发新帖 新投票
 回帖
查看积分策略说明快速回复主题
你的用户名: 密码:   免费注册(只要30秒)


启用 Html 代码
使用个人签名
(请您文明上网理性发言!并遵守相关规定贴文发布前,请确认贴文内容完全由您个人创作或您得到了版权所有者的授权。版权声明
   



Processed in 0.028998 s, 10 q - sitemap,