Skip to content

Commit

Permalink
maya's changes part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mayarajan3 committed May 20, 2024
1 parent 5522710 commit 387ef3a
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/lib/default-project/backdrop.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 23 additions & 5 deletions src/lib/default-project/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,31 @@ import motorWav from '!arraybuffer-loader!./tinybit_motor.wav';
import backdrop from '!raw-loader!./cd21514d0531fdffb22204e0ec5ed84a.svg';
import costume1 from '!raw-loader!./tinybit_top.svg';
import costume2 from '!raw-loader!./tinybit_heart.svg';
import svgVar from './tinybit_top';
import backdropVar from './backdrop'
import popWavVar from './popWav';
import meowWavVar from './meowWav';
import tinybit_motorWavVar from './tinybit_motorWav';
/* eslint-enable import/no-unresolved */

function base64ToArrayBuffer(base64) {
var binaryString = atob(base64);
var bytes = new Uint8Array(binaryString.length);
for (var i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return bytes.buffer;
}

const defaultProject = translator => {
costume1 = svgVar;
backdrop = backdropVar;

let _TextEncoder;
if (typeof TextEncoder === 'undefined') {
_TextEncoder = require('text-encoding').TextEncoder;
} else {
/* global TextEncoder */
_TextEncoder = TextEncoder;
}
const encoder = new _TextEncoder();
Expand All @@ -28,24 +46,24 @@ const defaultProject = translator => {
id: '83a9787d4cb6f3b7632b4ddfebf74367',
assetType: 'Sound',
dataFormat: 'WAV',
data: new Uint8Array(popWav)
data: new Uint8Array(base64ToArrayBuffer(popWavVar)),
}, {
id: '83c36d806dc92327b9e7049a565c6bff',
assetType: 'Sound',
dataFormat: 'WAV',
data: new Uint8Array(meowWav)
data: new Uint8Array(base64ToArrayBuffer(meowWavVar))
}, {
id: '93c36d806dc92327b9e7049a565c6bff',
assetType: 'Sound',
dataFormat: 'WAV',
data: new Uint8Array(motorWav)
data: new Uint8Array(base64ToArrayBuffer(tinybit_motorWavVar)),
}, {
id: 'cd21514d0531fdffb22204e0ec5ed84a',
assetType: 'ImageVector',
dataFormat: 'SVG',
data: encoder.encode(backdrop)
}, {
id: 'bcf454acf82e4504149f7ffe07081dbc',
id: 'b7853f557e4426412e64bb3da6531a99',
assetType: 'ImageVector',
dataFormat: 'SVG',
data: encoder.encode(costume1)
Expand All @@ -59,4 +77,4 @@ const defaultProject = translator => {
];
};

export default defaultProject;
export default defaultProject;
3 changes: 3 additions & 0 deletions src/lib/default-project/meowWav.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/lib/default-project/popWav.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/lib/default-project/project-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ const projectData = translateFunction => {
currentCostume: 0,
costumes: [
{
assetId: 'bcf454acf82e4504149f7ffe07081dbc',
assetId: 'b7853f557e4426412e64bb3da6531a99',
name: translator(messages.costume, {index: 1}),
bitmapResolution: 1,
md5ext: 'bcf454acf82e4504149f7ffe07081dbc.svg',
md5ext: 'b7853f557e4426412e64bb3da6531a99.svg',
dataFormat: 'svg',
rotationCenterX: 128,
rotationCenterY: 145
Expand Down
3 changes: 3 additions & 0 deletions src/lib/default-project/tinybit_motorWav.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/lib/default-project/tinybit_top.js

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 387ef3a

Please sign in to comment.