more than 2 years after the most recent patch, victus 0.12.0 is here! it's the biggest victus update ever, and not in terms of the file size - in fact, quite the opposite, as this build is less than 1400 bytes in size!
features
file size improvements
- builds are now crushed using the brilliant JSCrush algorithm, saving nearly 1000 bytes.
- a 3-byte-per-key version of JS1k's time-honored canvas context hash trick is now used internally, saving 33 bytes before crushing.
Primitive.clone()
is now just 2 lines long.- countless other byte saves all over the framework.
new stuff
- the
Primitive
class has been added to thevictus
object, allowing for the creation of custom classes which extend it. - new rotation features are now available, including an
rv
property for rotational velocity as well asrotateTo()
androtateBy()
methods. - the
Rect
,Ellipse
, andSprite
classes now include apath
property, allowing for the use ofCanvasRenderingContext2D.isPointInPath()
. - the
keys
object has been completely refactored, and now exposespress
andheld
properties for every key returned byKeyboardEvent.key
.
quality of life
- the canvas context is now simply exposed as
victus.ctx
. - the
Sprite.spr
,Sound.vol
, andSound.loop
properties can now be set directly. Sound.vol
is now optional (defaults to 1).
bugfixes
- the
let
keyword is now used instead ofvar
(#1). Primitive.xv
andPrimitive.yv
are now in pixels per second, not pixels per frame.Primitive.ax
andPrimitive.ay
are now relative to the top left corner of the canvas, not the top left corner of the primitive.- the anchor point of a primitive will now move when the primitive does.
Ellipse
instances are now drawn with the correct radii.Sound.reset()
now sets the sound'scurrentTime
property to0
instead of reloading the whole sound.
other changes
- a
test
directory has been created. - certain keywords and method names have been changed; see the 0.11.2 → 0.12.0 migration guide for more information.
0.11.2 → 0.12.0 migration guide
- because of the change in units of
Primitive.xv
andPrimitive.yv
, these values should now be divided by 60. - also note the change to
Primitive.ax
andPrimitive.ay
, and change relevant code accordingly. - the
Primitive.setProps()
method has been changed toPrimitive.set()
. - the
Primitive.rotation
property has once again been changed toPrimitive.r
.