Note, the Scripting part took at least one hour… 
Possible Implementation:
- Use the following classes for multimedia tools:
-
MMEncode(images: ImageData[], audio: Audio, framerate: number): Blob
, do encode images and audio into video using FFmpeg.
-
MMDecode(video: Blob): [ImageData[], Audio]
to decode video to images and audio.
- Use the following classes for easy video playing:
-
WickVideo
: Basically a WickObject
with special video powers.
- Has
@loadVideo
, which uses MMDecode
to make a timeline with all the videos’ frames as images.
- Contains
@currentVideo
, a string
ref to the video being played currently.
- Wick may worsen playback, due to the massive amount of images being imported at once.
Scripting update!
The scripting in legacy wick is not usable. Even myself, could not figure, what are these scripts doing?
So, to improve the problem, I’ll rewrite the whole scripting framework in Wick Editor.
(Proposed) Changes:
- Change from
javascript (.js)
to coffeescript (.coffee)
, making most scripts easier:
// Example JS script.
var mySecret = random.uuid4();
var myObj = {
secret: mySecret,
name: "someObjectImUsingLater",
script: "function click(){ alert('peekaboo!') }",
someVectorData: new VecData generatedDataFromEarlier...,
position: new Vec2(100, 100)
};
console.dir(myObj); // the syntax to force-log as a object.
function myFunction(...props) {
for (var i=0;i<props.length;i++) {
alert(props[i]);
}
}
myFunction("Hello", "World!")
Now the Coffee Script version:
# Example CoffeeScript Script
mySecret = random.uuid4()
myObject =
secret: mySecret,
name: "someObjectImUsingLater",
script: "function click(){ alert('peekaboo!') }",
someVectorData: new VecData(generatedDataFromEarlier...),
position: new Vec2 100, 100
console.dir myObj # the syntax to force-log as a object
myFunction = (props...) ->
for prop in props
alert prop
return # lil' hack so the code doesn't generate a return here.
myFunction "Hello", "World!" # call function test
which generates:
// Example CoffeeScript Script
var myFunction, myObject, mySecret;
mySecret = random.uuid4();
myObject = {
secret: mySecret,
name: "someObjectImUsingLater",
script: "function click(){ alert('peekaboo!') }",
someVectorData: new VecData(...generatedDataFromEarlier),
position: new Vec2(100, 100)
};
console.dir(myObj); // the syntax to force-log as a object
myFunction = function(...props) {
var i, len, prop;
for (i = 0, len = props.length; i < len; i++) {
prop = props[i];
alert(prop); // lil' hack so the code doesn't generate a return here.
}
};
myFunction("Hello", "World!"); // call function test
Objectively, CoffeeScript is easier, and more helpful on coding- wait… I forgot about the class syntax, silly me!
# Class Creation Speedrun %ANY%
class Position
# the @val tells it to do the boilerplate of this.val = val.
constructor: (@x, @y) ->
toArray -> [@x, @y]
class Player
constructor: (@name, pos) ->
@pos = pos if pos instanceof Position
Which translates into:
var Player, Position;
Position = (function() {
class Position {
constructor(x, y) {
this.x = x;
this.y = y;
}
};
toArray(function() {
return [this.x, this.y];
});
return Position;
}).call(this);
Player = class Player {
constructor(name, pos) {
this.name = name;
if (pos instanceof Position) {
this.pos = pos;
}
}
};
Also, if you’re still reading through my walls of transpiled code, thanks!
Scripts shown here will all be in CoffeeScript from now on…
- Scripts now will have a simplified runner
# old way
editor = wickEditor or wickPlayer
editor.runScript mainFactory, "create",
create: "Firey",
amount: 50,
callInit: true
# new (proposed) way
@run "create", #local way
create: "Firey",
amount: 50,
callInit: true
# Global Way
editor = wickEditor or wickPlayer
editor.run mainFactory, "create",
create: "Firey",
amount: 50,
callInit: true
I could go creating more things, but just these two improve scripts by a lot.