Code covered by the BSD License  

Highlights from
Fireworks GUI

image thumbnail

Fireworks GUI

by

 

30 Dec 2010 (Updated )

Enjoy some fireworks (with sound) with this interactive GUI

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

getCustomVelAng(param)
function [vel, ang] = getCustomVelAng(param)

% Author: Jiro Doke
% Date: Dec 28, 2010
% Copyright 2010-2012 The MathWorks, Inc.

switch param.FireworksType
    case 'symmetric'
        ang = (1:param.NumPetals)*2*pi/param.NumPetals;
        vel = 35*ones(1, param.NumPetals);
    case 'asymmetric'
        ang = (1:param.NumPetals)*2*pi/param.NumPetals + 0.1*rand(1, param.NumPetals) - 0.5;
        vel = 35+20*rand(1, param.NumPetals) - 10;
    case 'heart'
        vel = [40 30 24 30 39 43 39 29 26 35 28 29 38 43];
        ang = [0.951 1.27 1.6 1.86 2.18 2.44 2.76 3.34 4.16 4.8 5.38 6.2 0.377 0.691];
    case 'a'
        vel = [25 37 48 41 35 32 33 48 21 12 4 33 11 16];
        ang = [1.52 1.71 1.85 2.05 2.31 2.63 3.08 3.65 3.1 3.04 2.76 5.39 6.28 1.19];
    case 'b'
        vel = [15 29 33 34 39 27 21 25 37 31 29 25 14 4];
        ang = [0.512 0.772 1.22 1.67 2.12 2.44 3.08 3.72 4.1 4.61 5.13 5.64 5.9 2.7];
    case 'c'
        vel = [30 33 34 31 28 27 27 28 29 28 28];
        ang = [0.823 1.14 1.59 2.1 2.6 3.18 3.75 4.32 4.89 5.33 5.65];
    case 'd'
        vel = [31 32 32 34 38 26 21 22 29 39 33 32 32 31 30];
        ang = [0.419 0.838 1.26 1.68 2.09 2.45 2.93 3.48 3.9 4.13 4.54 5.03 5.45 5.86 6.28];
    case 'e'
        vel = [10 37 33 33 38 26 21 22 29 39 34 33 37 9 0];
        ang = [3.12 1.09 1.38 1.74 2.09 2.45 2.93 3.48 3.9 4.13 4.48 4.84 5.19 6.28 6.22];
    case 'f'
        vel = [10 37 33 33 38 26 21 22 29 39 9 0];
        ang = [3.12 1.09 1.38 1.74 2.09 2.45 2.93 3.48 3.9 4.13 6.28 6.22];
    case 'g'
        vel = [26 29 30 30 28 26 23 23 27 30 31 29 24 15 9];
        ang = [0.545 0.963 1.26 1.61 1.97 2.32 2.81 3.48 4.08 4.69 5.17 5.59 5.89 5.61 4.9];
    case 'h'
        vel = [23 30 40 4 13 39 29 22 22 30 39 6 16 40 31 23];
        ang = [0.267 0.723 0.99 3.33 3.22 2.1 2.37 2.83 3.47 3.93 4.13 6.16 6.22 5.31 5.51 5.97];
    case 'i'
        vel = [3 39 35 35 39 34 21 8 34 30 30 35 29 16];
        ang = [4.66 1.09 1.35 1.8 2.06 1.56 1.57 1.58 4.16 4.43 5 5.32 4.7 4.71];
    case 'j'
        vel = [8 42 37 34 35 35 23 13 32 32 28 22 31 14];
        ang = [6.22 0.96 1.16 1.54 1.8 1.31 1.19 0.889 3.6 3.86 4.37 4.69 4.14 5.15];
    case 'k'
        vel = [37 25 14 10 38 28 21 19 25 35 4 12 24 36];
        ang = [1.08 1.21 1.53 2.67 2.06 2.32 2.7 3.34 3.85 4.11 4.43 5.13 5.27 5.28];
    case 'l'
        vel = [33 37 37 30 23 20 22 28 36 32 30 31];
        ang = [5.11 5.32 2.14 2.28 2.62 3.14 3.6 3.94 4.15 4.36 4.63 4.9];
    case 'm'
        vel = [42 32 21 11 21 31 41 32 24 22 28 40 43 31 25 27 34];
        ang = [0.935 0.991 1.11 1.6 1.97 2.09 2.15 2.33 2.7 3.26 3.81 4.12 5.37 5.68 6.16 0.384 0.754];
    case 'n'
        vel = [42 30 16 3 13 26 41 32 24 22 28 40 43 31 25 27 34];
        ang = [0.935 5.39 5.44 0.347 1.91 2.09 2.15 2.33 2.7 3.26 3.81 4.12 5.37 5.68 6.16 0.384 0.754];
    case 'o'
        vel = [31 34 35 33 31 28 30 33 35 33 29 29];
        ang = [0.586 1.05 1.57 2.03 2.49 3.14 3.67 4.19 4.71 5.24 5.76 6.28];
    case 'p'
        vel = [32 34 34 34 37 27 18 19 27 37 11 9 18 26];
        ang = [0.637 1.02 1.41 1.8 2.06 2.25 2.83 3.59 4.04 4.24 3.93 5.26 6.15 0.251];
    case 'q'
        vel = [29 33 35 35 32 28 25 23 25 29 29 28 27 26 21 34 42];
        ang = [0.495 0.928 1.3 1.67 2.04 2.41 2.84 3.33 3.89 4.45 4.95 5.38 5.81 6.28 5.42 5.41 5.53];
    case 'r'
        vel = [19 27 32 34 34 35 38 30 22 19 25 39 9 17 28 41 7 5];
        ang = [0.223 0.635 0.922 1.21 1.56 1.84 2.07 2.23 2.58 3.18 3.84 4.19 4.35 5.01 5.17 5.27 3.2 6.22];
    case 's'
        vel = [29 34 35 35 35 35 30 19 5 7 29 33 34 34 34 29 20];
        ang = [0.6 0.887 1.11 1.46 1.75 2.09 2.44 2.67 3.02 5.94 3.78 4.19 4.6 5.01 5.36 5.65 5.87];
    case 't'
        vel = [42 37 34 34 37 41 33 23 13 3 9 19 29];
        ang = [0.923 1.09 1.32 1.81 2.04 2.21 1.56 1.54 1.52 1.44 4.75 4.73 4.71];
    case 'u'
        vel = [26 32 41 41 33 27 24 24 24 24 24 25 24 23];
        ang = [0.449 0.772 0.969 2.17 2.37 2.69 3.14 3.65 4.1 4.49 4.94 5.39 5.77 6.28];
    case 'v'
        vel = [23 33 44 44 33 23 15 13 16 25 15 11 14];
        ang = [0.637 0.835 0.907 2.24 2.37 2.57 2.95 3.72 4.29 4.68 5.07 5.77 0.251];
    case 'w'
        vel = [23 27 35 44 45 34 25 21 24 34 23 13 4 13 24 35 26];
        ang = [6.15 0.425 0.732 0.913 2.22 2.41 2.71 3.27 3.83 4.2 4.19 4.31 4.93 5.3 5.29 5.29 5.65];
    case 'x'
        vel = [41 29 15 3 15 27 41 9 23 35 9 23 38];
        ang = [0.923 0.967 1.14 1.56 2.04 2.15 2.19 3.87 3.97 4.02 5.63 5.49 5.4];
    case 'y'
        vel = [41 29 15 3 15 27 41 11 23 35];
        ang = [0.923 0.967 1.14 1.56 2.04 2.15 2.19 4.75 4.73 4.71];
    case 'z'
        vel = [43 36 35 39 31 17 6 34 30 32 40 20 6];
        ang = [0.923 1.28 1.7 2.06 0.909 0.889 0.87 4.18 4.6 5.08 5.44 4.23 4.4];
    case '?'
        vel = [27 32 35 35 32 26 32 32 17 11 4 9 18];
        ang = [0.797 1.16 1.45 1.81 2.1 2.4 4.77 4.68 4.73 4.71 4.75 0.126 0.503];
    case '!'
        vel = [36 26 36 27 17 7 33 33 11 4 4 6 17];
        ang = [1.43 1.41 1.32 1.3 1.29 1.14 4.58 4.49 4.6 4.96 4.71 1.45 1.38];
    case 'matlab'
        vel = [17 31 14 32 44 37 26 10 30 50 25 33 24 39 26 24 33 50 33 27];
        ang = [1.76 1.51 3.39 1.07 1.45 1.63 2.07 2.26 2.89 3.2 4.21 3.64 3.83 4.52 4.9 5.53 5.72 5.72 6.16 0.44];

end

end

Contact us